PHP Help with inherited database site

Hope someone can help with this, although I might be a bit vague. (But will be happy to post any code that might help.)
Basically I do a few sites for a company, and everything is coming together nicely moving everything to a new reseller hosting account where everything can site. I'm basically doing some redesign and new database work for them.
But there's one site I'm basically just trying to move over, that already has a database. I've copied the site onto the new hosting, copied the database across and created a new connection file.
I must admit the code is all a bit more PHPO heavy than what I'm used to working with. so have run into a problem trying to figure out what data is not displaying due to queries failing. As far as I can tell the connection is working, and the queries have not changed.
Anyway - the main page is here, where you should be able to click on the furniture images to go to the product page :
http://www.miradatravelmedia.com/lusty/public_html/index.php
But when you click through the product page query is failing :
http://www.miradatravelmedia.com/lusty/public_html/products.php?category=1
The products page is mostly PHP and looks like this :
[PHP]<?php
if (!@empty($_REQUEST["img"])) {
  require_once("../includes/hft_image.php");
  $img = new hft_image($_REQUEST["img"]);
  $img->resize(200,180,"-");
  $img->output_resized("");
  exit;
$page = "products";
include("../includes/header.php");
include("../includes/db_open.php");
$sql = "SELECT `id`, `name` FROM `categories` WHERE `id` = '" . $_REQUEST["category"] . "'";
$result = mysql_query($sql) or die("Query failed : $sql at line " . __line__);
$category = mysql_fetch_assoc($result);
?>
<div id="trail"><a href="shop.php">Shop</a> &gt; Lloyd Loom <?php echo $category["name"]?></div>
  <div class="clear" id="divider1"><img src="images/spacer.gif" alt="<?php echo keyword()?>" /></div>
<h1>Lloyd Loom <?php echo $category["name"]?></h1>
<?php
$sql =
  "SELECT * " .
  "FROM `products` " .
  "WHERE `category` = '" . $_REQUEST["category"] . "' " .
  "ORDER BY `order`";
$result = mysql_query($sql) or die("Query failed : $sql at line " . __line__);
if (mysql_num_rows($result) == 0) {
?>
<p>Coming soon ...</p>
<?php
} else {
  $n = 0;
  while ($row = mysql_fetch_assoc($result)) {
    $n++;
?>
<a href="product.php?id=<?php echo $row["id"]?>" class="product"<?php if ($n == mysql_num_rows($result)) echo " id=\"last\""?>>
<?php
    if ($file = glob("images/products/" . $row["id"] . "_*.*")) {
?>
<img src="img.php?img=<?php echo $file[0]?>&width=200&height=180" alt="<?php echo $row["code"]?>" />
<?php
    } else {
?>
<div id="no_image">No image found</div>
<?php
?>
<?php echo $row["code"]?>
</a>
<?php
    if (is_int($n / 4)) {
?>
<div class="clear"><img src="images/spacer.gif" alt="<?php echo keyword()?>" /></div>
<?php
?>
  <div class="clear" id="divider2"><img src="images/spacer.gif" alt="<?php echo keyword()?>" /></div>
<?php
include("../includes/footer.php");
?>[/PHP]
If anyone could shed any light on what's going wrong still, that would be much appreciated.
Thanks.

Iain71 wrote:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''categories' WHERE 'id' = '1'' at line 1
So it does look a bit odd with the quotes.
Column names in a SQL query must not be in quotes. The MySQL error message tells you that the SQL syntax error is "near" the section it refers to. In other words, the error is just before that part of the query. Normally, you need to display the whole query to spot the error, but it's obvious in this particular case, because there's a quotation mark after categories, indicating that you've put the column name in quotes. Anyway, you've solved that problem by using the version I suggested.
I still haven't managed to establish where this vat.php file is - is there any explanation for it not being visible on the original hosting server where the site is working? And could it have anything to do with the query not working?
No, it has nothing to do with the query not working, and the reason you can't see it on the live site is because there's no error. The error message on your test site tells you exactly where to look for the problem. The file vat.php is included by header.php on line 19. Either vat.php isn't on your server, or the code on line 19 of header.php is pointing to the wrong location.

Similar Messages

  • Help with fonts on site design

    I need help with the fonts. For my menu i used a pixel font
    (so no anti-alias enabled). When i test my site and click on the
    links, the pixel font turns into and anti-alias font and it makes
    everything look ugly. How can i fix this??
    heres my .swf file. Click on portfolio link then webdesign
    and see what i mean
    http://img411.imageshack.us/my.php?image=siteyl9.swf&width=800

    quote:
    Originally posted by:
    Elenaa5
    Thank you! That worked =)
    You're welcome.
    I like your site, keep up the good work =)

  • Help with local database

    hye...
    i have some problem with mySQLite database.i have this code
    for my application (in attachment).when you clik the load button,it
    will load a text file on the desktop directory.when you click the
    filter function it will split the text file according to an array
    that i have specified.
    the text file consist of some data like this:66.249.71.54 - -
    [10/Oct/2008:03:31:01 +0800] "GET
    /mod.php?_call=Kalendar&day=2014-05-09 HTTP/1.1" 200
    66.249.71.54 - - [10/Oct/2008:03:31:57 +0800] "GET
    /KERIAN%20ENG/Towns/Main_Town.htm HTTP/1.0" 404
    i have created a database on my desktop using one tool that i
    have downloaded and point to that database.
    the probllem now is,i want to store the "200" only strings
    into the database.strings other than "200" will be not stored in
    the database.can u show me how to do this..
    i hope you can understand what i want...
    thanks for your time..

    ty for your reply
    my boss was dead set to make it work so we get down to it.. he says that this particular conf was now soppurted by oracle (dont think so), but well we modified the realese and now we have the vm server in the box with the vm manager and cam working..
    now i what to discover the server and throws this error
    OVMAPI_4010E Attempt to send command: discover_hardware to server: ovm1.grtn.cfe.gob.mx failed. OVMAPI_4004E Sync command failed on server: 10.0.2.210. Command: discover_hardware, Server error: org.apache.xmlrpc.XmlRpcException: <type 'exceptions.Exception'>:ERROR 0 @ 730 parse_multipath_conf_file() ERROR: /etc/multipath.conf could not be read !?! ERROR 1 @ 372 fill_blkDevInfo_scsi_device() blkdev 'dm-0' bad devLink [../devices/virtual] !?! Runtime errors occured [2] [Tue Jan 20 05:58:32 CST 2015] [Tue Jan 20 05:58:32 CST 2015]
    this is in the vm manager 3.3.1 console
    try to check the etc/multipath.conf and its not there and i have no idea why..

  • Help with a "buggy" site

    Hey guys,
    I finally got my domain with my flash site up on it. It's a fairly simple site, but I have been having a lot of times (especially with optimizing and making it fast) Im still having speed issues, even though I have linked every image, optimized every image, etc. So I guess thats my first questions: any secrets I may not have heard of for optimizing?
    Second, when you open my site you will see some other bugs. My homepage is what I call a clicktable, and as soon as you click a square, a dotted line surrounds the entire "workspace" like it is outlinging the exact size of my catalyst document. This appeared out of the blue..I have no idea why (it was up on another server with no problems). Another problem is when you click to different pages things kind of spaz out (you will see what I mean)...another problem that never used to be there. If anyone has any tips on any of this I would be very grateful! Also, any critique in general. Thanks!
    Zack

    See Corrupt iPod classic.
    tt2

  • PHP help with nested repeat region

    Hopefully someone can help me out with this one.
    I basically have some SQL returning results of a search page,
    where you can search on various keywords by checking boxes, and it
    returns Employers that match those keywords :
    mysql_select_db($database_myDatabase, $myDatabase);
    if (isset($_GET['ckbox'])){
    // get profile keys
    $ckbox = array_keys($_GET['ckbox']);
    // sql string
    $sql = 'SELECT Employers.*, EmployerContacts.* FROM
    EmployerContacts
    INNER JOIN Employers ON EmployerContacts.EmployerID =
    Employers.EmployerID
    INNER JOIN EmployerProfiles ON EmployerProfiles.EmployerID =
    EmployerContacts.EmployerID
    WHERE EmployerProfiles.ProfileID IN(' . implode(',',
    $ckbox).')
    GROUP BY Employers.EmployerID
    ORDER BY Employers.EmployerID DESC';
    $rsContacts = mysql_query($sql) or die(mysql_error());
    $row_rsContacts = mysql_fetch_assoc($rsContacts);
    @$totalRows = mysql_num_rows($rsContacts);
    else
    echo 'You did not check any profiles.';
    ?>
    The results are drawing fields from the Employers table and
    EmployerContacts table, hopefully to look like :
    Employer1
    Employer1.Contact 1
    Employer1.Contact 2
    Employer1.Contact 3
    Employer2
    Employer2.Contact 1
    Employer2.Contact 2
    Employer2.Contact 3
    etc
    However, I can only seem to get it to repeat the Employers,
    and show just the first Contact for each, like this :
    Employer1
    Employer1.Contact 1
    Employer2
    Employer2.Contact 1
    etc
    So I guess I'm looking for help with looping through the
    Contacts for each Employer.
    The code currently looks like this :
    [code attached]
    Hope that makes sense.
    Many thanks.

    Iain71,
    The DW Repeat Region cannot be nested because both loops use
    the same
    variable names (e.g. $RepeatSelectionCounter_1).
    You will have to manually edit the code, and DW may not
    recognize it
    after you do, but you should be able to get it working fairly
    easily. I
    think that you just need to change the variable names in the
    inner loop
    so that they do not conflict with the similar names in the
    outer loop
    (e.g. rename $RepeatSelectionCounter_1 to
    $RepeatSelectionCounter_2).
    Does that make sense?
    HTH,
    Randy
    > I basically have some SQL returning results of a search
    page, where you can
    > search on various keywords by checking boxes, and it
    returns Employers that
    > match those keywords :

  • Need some help with social net site

    I need to create a site with editable user profiles, the site
    will feature sports stats that the user can update.
    I use Dreamweaver and MYSQL but I need some direction. Im
    starting from scratch here, are there any templates or free source
    code to go off of? I really need some help!!

    "Funks Da Burn" <[email protected]> wrote in
    message
    news:g1np74$eej$[email protected]..
    >I need to create a site with editable user profiles, the
    site will feature
    > sports stats that the user can update.
    > I use Dreamweaver and MYSQL but I need some direction.
    Im starting from
    > scratch here, are there any templates or free source
    code to go off of? I
    > really need some help!!
    That's not something you can do using templates or by
    dropping in a free
    script; it's pretty complicated. You need to know how to
    design a database
    and write server-side code. Dreamweaver will help you write
    the code, but
    you still need to plan and design the whole application. I'd
    recommend
    starting with a book. It sounds like PHP is going to be your
    best bet - does
    your host server support it? If so, do a search on Amazon.com
    for books on
    Dreamweaver and PHP, and/or ask for recommendations here.
    Patty Ayers | www.WebDevBiz.com
    Free Articles on the Business of Web Development
    Web Design Contract, Estimate Request Form, Estimate
    Worksheet

  • Help with dynamic database

    I'm still stuck on learning database-driven development. I
    plan to take the Lynda.com free lessons... but until then, if
    anyone can help me, I'd be very appreciative:
    Here are today's questions:
    My manager (VP eng./sales/mktg) wants to know WHY I think
    Dreamweaver is better for developing database-driven applicaitons
    than C# in an asp.net environment. I believe DW is better at
    supporting CSS and enabling an user-friendly design for the UI, but
    I don't know whether C# can do all the same things... (C# is a
    development tool for the asp.net environment).
    Can you help me identify why DW is better than C# for either
    the entire dynamic site development OR just the UI?
    Also I need to learn how to attach my sql queries (already
    written) to an html page created in dreamweaver, We have an IIS
    webserver. Here's how I see the process:
    a) Kick off the query from a DW html page
    b) access the DB through the web server (IIS?)
    c) recieve the results back from the database
    d) render the results on a DW page.
    The sql is going to an oracle DB.
    I can access oracle and run the query (using SQL plus) from
    my PC, so the only question is how to I hook it up to DW...
    Anything you can say to shed light on any of these would be
    so helpful!
    THanks,
    Jane

    Hi Jane,
    You must remember DW is a tool for creating websites. You
    could use C#
    for your website and do the coding of C# in DW. DW is not a
    scripting
    language as PHP, ASP and C# are.
    As for the query, do you know what scripting language you
    would be using
    to connect to the Oracle DB (ASP, PHP, etc.)? Once you let us
    know what
    you are using it will be easy to give an example.
    Cheers.
    Chris
    basketcasecafe1 wrote:
    > I'm still stuck on learning database-driven development.
    I plan to take the
    > Lynda.com free lessons... but until then, if anyone can
    help me, I'd be very
    > appreciative:
    >
    > Here are today's questions:
    >
    > My manager (VP eng./sales/mktg) wants to know WHY I
    think Dreamweaver is
    > better for developing database-driven applicaitons than
    C# in an asp.net
    > environment. I believe DW is better at supporting CSS
    and enabling an
    > user-friendly design for the UI, but I don't know
    whether C# can do all the
    > same things... (C# is a development tool for the asp.net
    environment).
    >
    > Can you help me identify why DW is better than C# for
    either the entire
    > dynamic site development OR just the UI?
    >
    > Also I need to learn how to attach my sql queries
    (already written) to an html
    > page created in dreamweaver, We have an IIS webserver.
    Here's how I see the
    > process:
    > a) Kick off the query from a DW html page
    > b) access the DB through the web server (IIS?)
    > c) recieve the results back from the database
    > d) render the results on a DW page.
    >
    > The sql is going to an oracle DB.
    > I can access oracle and run the query (using SQL plus)
    from my PC, so the
    > only question is how to I hook it up to DW...
    >
    >
    > Anything you can say to shed light on any of these would
    be so helpful!
    > THanks,
    > Jane
    >
    >
    >
    >
    >

  • Noob needs help with hosting multiple sites

    Hello I am new to this multi hosting. I have looked on the forum for answers but haven't found any. I am trying to figure out how to host multiple sites. I have my dns working for my default site "example1.com", but need to know if I need to add another dns record for my second site. "example2.com". Also when I point to the new fold that has the second site in it and I assign it port 82 for testing purposes I get an error message saying 403 access forbidden. I need to find out how get permission to view the site for the public. Its in a separate folder on an external hard drive right now for testing purposes. Can any body help me or point me in the right direction? Thanks so much!!!
    -Kcam1999

    {quote}
    While what you are telling him is technically functional, it is not correct
    I beg to differ, Paul. You are the one that is not correct.
    CNAMES have been deprecated as of some years ago
    What? huh? really?
    Please show me any official document that states this (and not someone who just started a rumor because he didn't understand them). Indeed, the DNS RFC makes no such claim.
    {quote}
    I stand very much corrected. CNAMEs are not officially deprecated. Interestingly, your post cites precisely what happens when CNAMES used carelessly. How many transactions are needed to resolve Apple's CNAME chain below? RFC1912 (http://www.faqs.org/rfcs/rfc1912.html) has some recommendations that suggests Apple's own network folks have, like me and perhaps even others here, some learning to do. Is that a 'best practice?'
    {quote}> Then make sure you tell Apple since this site depends on the use of CNAMEs:
    dig discussions.apple.com
    discussions.apple.com. 492 IN CNAME discussions.apple.com.edgesuite.net.
    discussions.apple.com.edgesuite.net. 4427 IN CNAME a1399.b.akamai.net.
    a1399.b.akamai.net. 2 IN A 128.241.220.82
    a1399.b.akamai.net. 2 IN A 128.241.220.72
    In fact, it uses TWO CNAMES in a chain. Oh my.{quote}
    From RFC1912 (which I'm sure many have now read here), section 2.4 is as follows:
    {quote}... having chained records such as CNAMEs pointing to CNAMEs may
    make administration issues easier, but is known to tickle bugs in
    some resolvers that fail to check loops correctly. As a result some
    hosts may not be able to resolve such names.{quote}
    {quote}> It is not valid to say "don't use these because they could cause problems'. A records can be just as problematic, as can PTRs. Let's not even talk about MX.{quote}
    How, exactly, does is an A record problematic? No chains, no additional lookups, no wasted cycles...
    We differ here -- and if we are dealing with a newbie, we don't need to enter into unnecessary complexity UNTIL it is a requirement for their solutions.
    {quote}> There are many valid reasons to use CNAMEs in DNS, not least of which is the ease of moving a service if it uses CNAMEs. For example, if you have 10 A records all pointing at the same server and you want to migrate to a different machine you have to locate and update all 10 records. If they used a CNAME to the physical server you could move them all at once using a single change. This is especially important in cross-domain links where you may not control all the origin zone files.
    {quote}
    You're somewhat reaching here, and it is well beyond the scope of the OP's post or needs (well, until they tell us more about their needs, I suppose). There is nothing difficult about 'finding' and updating the necessary records. The final example you gave is a good one and I'll say THAT is an appropriate use of a CNAME, 'though there are other workarounds for it.
    Thanks for keeping me honest.

  • Help with iTunes database and Time Machine after Lion clean install

    I did a clean install of OS X Lion and think I've given myself problems with my Snow Leopard Time Machine backup and with my iTunes Library database files.
    My iMac (2007) had become very sluggish so I opted for a clean install.  Before the install of Lion my Snow Leopard 10.6.8 internal 1TB HD was at about  600GBs.  I was using Time Machine to backup to an external 1TB drive.  I had my iTunes 10.?  library on the same drive.
    For the Lion install I partitioned my internal 1TB HD into two partitions - a 250GB Lion boot partition and the rest for Lion data files.
    Now I  have two problems - 1.  I can't  work out how to re-connect my Time Machine backups, since they were related to a much bigger original drive, and 2.  I can't seem to find my iTunes database files.
    I also don't want to restore any application files at this stage, as I'm determined to do a fresh install of only the applications I need as I go along, and hopefully  avoid the issues of sluggishness I had with Snow Leopard.
    I have all my iTunes files in their pre-Lion external HD folder, but that folder does not seem to  have the iTunes Library.XML or iTunes Library files.  I didn't delete them so I'm hoping they were in my iTunes folder on my SL boot drive.  But that drive was deleted during the install, so I'll be depending on Time Machine to restore the database.
    Can anyone suggest a way to deal with Time Machine for my Lion install, and a way to restore my iTunes database?  I'd like to keep as much of the Snow Leopard Time Machine data as I can, while continuing to do Time Machine backups from my Lion installation.
    Anyone know where iTunes stores those database files, if not in the external drive iTunes folder? Spotlight search doesn't find the files, but is there a way to search my old Time Machine backups without having the Time Machine backups folder re-connected in Lion?
    Thanks.

    My iTunes folder is organised like this if it helps:
    And iTunes uses them from the Prefrences like this:
    Regards,
    Colin R.

  • Button help with asp database in dreamweaver

    Hey i have a page that has an iframe inside it with 2 menu's
    side by side with buttons in between to move items from one menu to
    another and i have them set with javascript to move back and forth
    works great only problem is its also supposed to update to the
    database as well and i used the update command feature in
    dreamwaver and i set it up but its still not working if i post my
    code can someone help me?

    If you're good with Flash and Action Script you could build a custom player.  Otherwise, pick-one from the links below. Some are free, some are not.
    Coffee Cup Video Player -- (supports playlists)
    http://www.coffeecup.com/video-player/
    Video LightBox --
    http://videolightbox.com/
    WWD Player -- supports playlists
    http://www.woosterwebdesign.com/flvplayer/
    Wimpy Rave -- supports playlists
    http://www.wimpyplayer.com/index.html
    JW Player --
    http://www.longtailvideo.com/
    FlowPlayer --
    http://flowplayer.org/
    YouTube --
    http://code.google.com/apis/youtube/getting_started.html
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

  • Help with a database view/table

    Hi,
    I have seperate oracle9i database on one machine (UNIX).
    Myview view has poor performance in dbtest, but it has good performance in dbdev.
    Both DBs are having relatively similar configuration.
    When I set the autotrace on I realized the indexes are in place on both databases.
    But it takes 2 times more to query dbtest than dbdev.
    Here is the difference when I query both views and the autotrace is on:
    SELECT id from Myview; on DBTEST:
    Statistics
    105 recursive calls
    0 db block gets
    83147 consistent gets
    456 physical reads
    0 redo size
    2777 bytes sent via SQL*Net to client
    400 bytes received via SQL*Net from client
    10 SQL*Net roundtrips to/from client
    4 sorts (memory)
    0 sorts (disk)
    122 rows processed
    SELECT id from Myview; on DBDEV:
    Statistics
    105 recursive calls
    0 db block gets
    42537 consistent gets
    267 physical reads
    0 redo size
    3601 bytes sent via SQL*Net to client
    414 bytes received via SQL*Net from client
    12 SQL*Net roundtrips to/from client
    4 sorts (memory)
    0 sorts (disk)
    157 rows processed
    How can I identify where the problem is? Why "consistent gets" and "physical reads" parameters are about 2 times in DBTEST. I believe this is why I have poor performance in DBTEST.
    Could someone give me a clue on how to idetify the issue?
    Thanks

    "I have seperate oracle9i database on one machine (UNIX)."Correction: "I have two seperate oracle9i database installed on one machine (UNIX).
    Can anyone help me with this? If you need more infor let me know.
    Thanks in advance.

  • Help with a database template - Desktop Product Inventory Template

    Hello Developers,
    I'm trying to develop a database to track purchase orders, supply levels, and supplies issued (with reports). I've been working with the MS Access template called "Desktop Product Inventory", but it has more functionality than I need (i.e. shipping,
    sales, invoicing). This template is almost exactly what I'm looking for.
    I've tried removing the fields I don't need, but I encounter errors everytime. Frustrated, I created a new database by studying and copying the format of the template. I have the general structure of the database setup with tabs, but I'm completly lost when
    it comes to formatting/coding the database. I'm not sure what needs to be done in order to recreate the functionality from the original template.   
    Unfortunately, I must admit that Access is my least favorite and used MS application.
    So, my questions are:
    1.) Does anyone know of an "effective" way to edit the Desktop Product Inventory template and maintain functionality?
    OR
    2.) Would someone mind taking a look at my database and giving me feedback? It's essentially just the layout  and what I want the database to show.
    Any and all help is appreciated, thanks for reading!

    The Microsoft template apps have a lot in them - which is why they are particularly difficult to modify by the novice - so don't feel bad. 
    A database that does  Inventory, shipping, sales, invoicing - is going to be complicated inherently, and is really a matter of development familiarity and experience.

  • Help with finding my site in google?

    hi all i have my site up and running and think i have it indexed?
    im after a bit of help regarding how people search for it? for example the website is for my turfing company based in essex called Unique Lawns. i need to know how i go about keywords so if someone was to type in google "turf laid in essex" my site would appear?
    my site is here if you need to look into the code etc: http://www.uniquelawns.com/
    i can find my site in google by typing unique lawns usualy in the top 6-7 on the first page which i think is pretty good as i only submitted it a few days ago, i have been reading about META keywords which im a bit confused about as some say they dont work in google?
    im just after some advice as to how i can get my site found when typing in keywords related to my site,
    also are google adwords any good as i have a free £50 voucher that came with my hosting?
    many thanks for any help

    If, as you say, some of your pages have been indexed by Google, chances are all pages have been indexed..... including the phrase:
    "turf laid in essex"
    A quick Google search returns
    About 1,440,000 results
    for that phrase...and I'll bet your's in there somwhere!
    Why even the mention of
    "turf laid in essex"
    has this Adobe post listed 4th position, first page... saying the post was added 17 minutes ago....
    so remember, in that 1,440,000 results, there are a lot of sites... all wanting to be on the first page... so why did the Adobe post make it and your site did not?
    Look at the time the Adobe Forum has been around... so you have to consider time.
    Look at the massive amount of quality content on the Adobe site... how does your site compare?
    Look at all the other inbound links that the Adobe Forum has built up over all those years? How about your site?
    Don't be discouraged, Google "SEO Princliple" and topics like that... TONS of info available.
    Just remember that pretty much everyone in those 1,440,000 results want to be first page... so competition can be stiff... review and build on sound SEO principles and don't expect it happen overnight.
    Best wishes,
    Adninjastator

  • Help with managing a site on business catalyst

    I am trying to set up a site for a friend of mine using muse. I made the site but would like to set it up for him to manage. He writes alot of articles and would like to post them onto the site himself. When I go into the BC page to manage it all the text is overlaying the other. Is there a way around this and is it possable for him to add more articles with the tabs on the side.
    Link to the site is www.lgbtcollege.com
    Please help me with this.

    Do you have access to a Partner Portal?  You can delete any of your sites from inside the Partner Portal.

  • PHP Help with Forms

    Hey everyone -
    I have a quote form on my website that I'd like to tweak a
    bit. There are
    some fields that have a drop-down box of "Yes" or "No" and
    directly after
    that it says, "If Yes, ..." So, no matter which option is
    chosen, the user
    still sees that even if it doesn't apply to them - which I'm
    OKAY with for
    the time being, but wish to implement it differently.
    If the user selects "Yes" - I'd like the the field that says
    the question I
    *need* to ask the user if they choose "Yes." If they select
    "No," than the
    box is never shown. Sounds simple enough, right? Right ...
    My concern is a). how to show this hide/don't hide
    functionality, and b).
    how to validate (require) the box being "shown" if they
    choose "Yes" and to
    NOT validate (require) if they choose "No."
    I'm going to upload a .html file to my server that has the
    full code for my
    quote.php page in plain text, so someone can help me
    implement this.
    Quote source code:
    http://www.avenuedesigners.com/tests/quote_source.html
    I colored the big chunks of PHP code red, and the form blue
    for ease.
    I've tried something like this:
    <?php
    if ($_POST['havewebsite'] == "Yes") {
    echo ('<p class="labelbold">If yes, What is the Domain
    Name?</p>
    <input name="currentdomain" type="text"
    class="contactfield2 inputstyled"
    id="currentdomain" value="<?php if
    (isset($_POST[\'currentdomain\'])) echo
    htmlentities($_POST[\'currentdomain\']);?>" tabindex="11"
    />');
    ?>
    And run into two problems:
    1. It only shows up when the page is submitted, and I'm
    naturally assuming
    this is because of the $_POST being in there. I need it to
    display
    immediately if they select "Yes."
    2. It physically prints out: <?php if
    (isset($_POST[\'currentdomain\']))
    echo htmlentities($_POST[\'currentdomain\']);?> - as the
    value of the
    textfield instead of leaving it blank/printing the previously
    entered text.
    How can I fix these, guys? Thank you!
    Shane H
    [email protected]
    http://www.avenuedesigners.com
    =============================================
    Proud GAWDS Member
    http://www.gawds.org/showmember.php?memberid=1495
    Delivering accessible websites to all ...
    =============================================

    you can apply a show-hide layer behavior to the YES check box
    (onClick="MM_ShowHideLayers...)
    and have the inverse show;hide behavior applied toi the NO
    checkbox.
    Once you have a Layer on your page and have applied the
    behavior, you change that Layer into a
    regular div by the way, just leave the same id.
    Then, for validating the question only if yes is selected:
    <?php
    if ($_POST['have_a_website'] == 'yes' &&
    empty($_POST['question'])){
    $error = TRUE;
    ?>
    Shane H wrote:
    > Hey everyone -
    >
    > I have a quote form on my website that I'd like to tweak
    a bit. There are
    > some fields that have a drop-down box of "Yes" or "No"
    and directly after
    > that it says, "If Yes, ..." So, no matter which option
    is chosen, the user
    > still sees that even if it doesn't apply to them - which
    I'm OKAY with for
    > the time being, but wish to implement it differently.
    >
    > If the user selects "Yes" - I'd like the the field that
    says the question I
    > *need* to ask the user if they choose "Yes." If they
    select "No," than the
    > box is never shown. Sounds simple enough, right? Right
    >
    > My concern is a). how to show this hide/don't hide
    functionality, and b).
    > how to validate (require) the box being "shown" if they
    choose "Yes" and to
    > NOT validate (require) if they choose "No."
    >
    > I'm going to upload a .html file to my server that has
    the full code for my
    > quote.php page in plain text, so someone can help me
    implement this.
    >
    > Quote source code:
    >
    http://www.avenuedesigners.com/tests/quote_source.html
    >
    > I colored the big chunks of PHP code red, and the form
    blue for ease.
    >
    > I've tried something like this:
    >
    > <?php
    > if ($_POST['havewebsite'] == "Yes") {
    > echo ('<p class="labelbold">If yes, What is the
    Domain Name?</p>
    > <input name="currentdomain" type="text"
    class="contactfield2 inputstyled"
    > id="currentdomain" value="<?php if
    (isset($_POST[\'currentdomain\'])) echo
    > htmlentities($_POST[\'currentdomain\']);?>"
    tabindex="11" />');
    > }
    > ?>
    >
    > And run into two problems:
    >
    > 1. It only shows up when the page is submitted, and I'm
    naturally assuming
    > this is because of the $_POST being in there. I need it
    to display
    > immediately if they select "Yes."
    >
    > 2. It physically prints out: <?php if
    (isset($_POST[\'currentdomain\']))
    > echo htmlentities($_POST[\'currentdomain\']);?> - as
    the value of the
    > textfield instead of leaving it blank/printing the
    previously entered text.
    >
    > How can I fix these, guys? Thank you!
    >
    seb ( [email protected])
    http://webtrans1.com | high-end web
    design
    Downloads: Slide Show, Directory Browser, Mailing List

Maybe you are looking for

  • Net value in the Invoice not populated correctly

    Hi friends, The net value in the Invoice is not populated correctly. The sales order unit price is say 100/EA and the qty is 10 and the net value is 1000 Rs. THe invoice is also showing up the unit price and qty similar to the sales order but the net

  • Embedded Youtube video sound issues HELP!!

    Hello. This is my site http://mattpartridgeanimation.com/ In my 'animation' section I'm loading youtube clips to my site using this AS3 script found here. This all works fine but when i use my buttons created in flash to load the new container_mc, th

  • I have to give the technical names to abaper for following fields to be pri

    I have to give the technical names to abaper for following fields to be printed in the GRN print out what r the table & field names for following Buyer's name   Project Number / Cost Center   Suppliers Delivery Note Number   Quantity Remaining (per M

  • ABAP trial version 7

    Is this still available from the download section --I'm getting these type of messages <b>Internet Explorer cannot display the webpage    Most likely causes: You are not connected to the Internet. The website is encountering problems. There might be

  • URGENT porting to Android and iOS?

    I am developing a Flash game and the deadline is by the end of this month. The game will need to be run on Android and iOS. I tried AIR, but it runs slowly due to there being frame-by-frame bitmap animations. Is there a good optimisation method for A