Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Jun 2007
    Location
    Scotts Valley, CA
    Posts
    49
    Member #
    15405
    Hi all,

    I think this is the right place to put this question, although if it belongs somewhere else, please someone let me know.

    I'm working with some dropdown menus that I populate using PHP. It's a two part version of the Country/State/City dropdown, with Season/Style as the categories. In order to get the second menu to populate based on the first, I use onchange="this.form.submit();". The method for the form is GET. I'd like to be able to take that GET variable from the onchange submit, and make it the selected choice when the page reloads.

    Cheers,

    k.

  2.  

  3. #2
    Member
    Join Date
    Apr 2007
    Posts
    96
    Member #
    15165
    Quote Originally Posted by kalchas
    onchange="this.form.submit();". The method for the form is GET. I'd like to be able to take that GET variable from the onchange submit, and make it the selected choice when the page reloads.
    On your loop to make your
    HTML Code:
    <select name="bunch_of_numbers">
    <option value="one">One</option>
    <option value="two">Two</option>
    You would put something in the loop like

    PHP Code:
    if($loopeddata["value"] == $_GET["bucnh_of_numbers"])
     echo 
    "<option value=\"" $loopeddata["value"] . "\" selected >" $loopeddata["name"] . "</option>";
    else
     echo 
    "<option value=\"" $loopeddata["value"] . "\">" $loopeddata["name"] . "</option>"

  4. #3
    Member
    Join Date
    Jun 2007
    Location
    Scotts Valley, CA
    Posts
    49
    Member #
    15405
    Worked like a charm!

    Thanks!

    k.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:18 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com