Hi I am new to PHP and I have a little problem
I have created a user registration form and on this form I have three drop downs one for title, prov/state and country. This creates a record in the database but when I create an edit user profile page and display the record I have a problem the record displaying correctly and I have tested the output but I cannot get the dropdowns to display the variable from the database
<select name="title" size="1" id="label">
<option selected="selec ted" value="Mr"><?ph p if (isset($_POST['title'])) {echo $_POST['title'];} else {echo "Mr";} ?></option>
<option value="Mrs">Mrs </option>
<option value="Ms">Ms</option>
<option value="Dr">Dr</option>
</select>
And I have the record being read from the database but the dropdown are always blank! I have tried to put the variable in the selected value but then when I submit the form it fails saying the field is empty (even though it is in the field)
My question is how can I display the record from mysql in drop downs and have it work when I submit the form after user has edited that field
Thank you
I have created a user registration form and on this form I have three drop downs one for title, prov/state and country. This creates a record in the database but when I create an edit user profile page and display the record I have a problem the record displaying correctly and I have tested the output but I cannot get the dropdowns to display the variable from the database
<select name="title" size="1" id="label">
<option selected="selec ted" value="Mr"><?ph p if (isset($_POST['title'])) {echo $_POST['title'];} else {echo "Mr";} ?></option>
<option value="Mrs">Mrs </option>
<option value="Ms">Ms</option>
<option value="Dr">Dr</option>
</select>
And I have the record being read from the database but the dropdown are always blank! I have tried to put the variable in the selected value but then when I submit the form it fails saying the field is empty (even though it is in the field)
My question is how can I display the record from mysql in drop downs and have it work when I submit the form after user has edited that field
Thank you
Comment