#1
  1. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    Okay, I've got this down pat, when the information (options) are coming from a database...

    but how do I go about it, when the information isn't coming from the db.

    with a text area, we put <?php echo $fieldsname; ?>

    this places the entered value backinto the field, if there's an error.

    what about select menus?

    or do we need to generate the select menu via php?
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    8
    Rep Power
    0
    Somewhere near the top of your page before this select put

    if (!isset($city)) $city = "ZZ";

    <select name=city>
    <option <?php if ($city == "ZZ") print "selected"; ?>>Select a City
    <option <?php if ($city == "Los Angeles") print "selected"; ?>>Los Angeles
    <option <?php if ($city == "Miami") print "selected"; ?>>Miami
    <option <?php if ($city == "New York") print "selected"; ?>>New York
    <option <?php if ($city == "Chicago") print "selected"; ?>>Chicago
    </select>
  4. #3
  5. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    Louie,
    Thanks for the reply, I figured out what I needed to do, and just finished it up...

    I opted for a for loop, to loop through all the options, (states/provinces) so there was more than 70 choices.



    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.

Similar Threads

  1. Repopulating a drop down form menu element
    By gurmukh in forum MySQL Help
    Replies: 8
    Last Post: June 23rd, 2004, 11:18 AM
  2. Making a form menu popup
    By foe in forum HTML Programming
    Replies: 1
    Last Post: February 15th, 2004, 10:29 PM
  3. Enable form on radio button select
    By (sic)master in forum HTML Programming
    Replies: 2
    Last Post: February 8th, 2004, 05:19 PM
  4. prevent duplicate entries in select menu
    By SeenGee in forum PHP Development
    Replies: 2
    Last Post: February 6th, 2004, 08:08 AM
  5. HTTP Error 400: Bad Request, with basic form
    By crackwombat in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 07:40 PM

IMN logo majestic logo threadwatch logo seochat tools logo