Link to home
Start Free TrialLog in
Avatar of UltraFlux
UltraFluxFlag for Canada

asked on

SELECT help with php and mysql

I have various select drop-down boxes which display dob, position, experience, etc

1. The user fills out the form and data is stored in mysql

2. The user edits the form all of my SELECT boxes are set to default.

How can I display the data from the table as default?  And also update the table if the SELECT changes?
Avatar of steezy
steezy

To set the default option for an HTML Select box all you have to do is add "selected" to the <option> tag like this:

<select name="something">
<option value="value1">Value1</option>
<option value="value2" selected>Value2</option>
<option value="value3">Value3</option>
</select>
ASKER CERTIFIED SOLUTION
Avatar of dr_dedo
dr_dedo
Flag of Egypt image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of UltraFlux

ASKER

Yes I already use a dynamic list ^^

<option value="1" <?php echo (($row['position']==1? ' selected ': '')) ?>>CEO</option>
<option value="2" <?php echo (($row['position']==2? ' selected ': '')) ?>>Manager</option>

This is what does it right?
Whichever item is in the DB will show selected and the rest wont.

dr_dedo I'm posting another question similar to this I just dont want to ask another question in here.