

![]() |
| ![]() | |||||||
|
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Platinum Lifetime Member Name: Paul Rogers Last Online: 09-26-2009 07:44 AM iTrader: (10) Join Date: Jun 2005
Posts: 1,251
DNF$: 0 Location: UK
Country: | PHP/MySQL setting selected option for Dropdown Menu I always see it on forums and stuff, when you go to edit your profile, your date of birth or whatever you put in a dropdown menu is shown to you, exactly how you selected it. I have a form where people enter their date of birth, location etc, and I want it so when they go to edit, they see their selections already selected in the dropdown list by adding selected='selected' to it, I really cant figure out how to do it, and my only workaround right now is to add a duplicate at the top of the dropdown list.
__________________ Get your first month free at hostgator |
| | |
| Sponsored Ads |
| | #2 (permalink) |
| DNF Addict Name: Scott Last Online: Today 01:10 PM iTrader: (133) Join Date: Dec 2006
Posts: 3,079
DNF$: 2,451 Location: 33143/04930
Country: | I don't fully understand the question, but I'm guessing you are looking for a script that will populate a form based on the drop down menu? Try this to get some ideas: http://www.codingforums.com/showthread.php?t=80345
__________________ All offers valid for 72 hours except running auctions. SJCParking.com | PrivateNursing.net | LaGuardiaParking.net Last edited by south; 03-20-2009 at 08:03 AM.. |
| | |
| | #3 (permalink) |
| Missing in action Name: Kate Last Online: Today 05:26 PM iTrader: (41) Join Date: Jul 2005
Posts: 4,626
DNF$: 27,483 Location: front line
Country: | Here is one example. The idea is that when the form loads, you retrieve their saved data from the DB. Let's just fetch their year of birth as an example. Then you build your combo using a loop (here current year = 2009 through 1909). The year that matches your variable gets the selected attribute. PHP Code: PHP Code:
__________________ VeryOldNames.com |
| | |
| | #4 (permalink) |
| Platinum Lifetime Member Name: Paul Rogers Last Online: 09-26-2009 07:44 AM iTrader: (10) Join Date: Jun 2005
Posts: 1,251
DNF$: 0 Location: UK
Country: | Thankyou! That was exactly what I was looking for with regards to their date of birth, but my biggest pain is Location of the users, with a long dropdown list is there an easy way about it? Its not really important, im just looking to have things working properly, if its too much hassle for me I may just duplicate their location such as "United States" at the top of the list.
__________________ Get your first month free at hostgator |
| | |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |