|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
populating a drop down menu/select box ?
hi,
I can populate a select box easy enough, so heres what i need. A user can make a selection from a select box and the selectionID is then stored in the database. On retrieval of his database selectionID, i need the select to first be filled from the database and then the selected item in the select box should be that of the selectionID from the users profile in the db.
__________________
regards, Fulton |
|
#2
|
|||
|
|||
|
you mean the last selected should be default?
|
|
#3
|
|||
|
|||
|
Yes. The default should be the stored value the user selected, which is stored in the db.
|
|
#4
|
|||
|
|||
|
Easy enough. In the select box's option tag, before closing the tag with ">", you test whether the $selectionID is equal to the value of that option. If it is, then you echo a space, followed by the word "selected".
Code might looks something like this: <option value="4"<? if ($selectionID=="4"){echo " selected";} ?>>Option 4</option> Hope this helps. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > populating a drop down menu/select box ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|