I'm looking for an old post that I saw, and now cant seem to find, concerning how to reset complicated form values from a record in a database (MySQL) so that the info can be updated. i.e. How do you restore the submitters original choices on a form? <value=<?$fieldname?>/> ? How can you re-select items in a dropdown menu? Thanks for any advice, code examples or tutorials locations. Virgil
Form Re-Population?
Moderator: General Moderators
Form Re-Population?
Hi PhP's (Peeps)
I'm looking for an old post that I saw, and now cant seem to find, concerning how to reset complicated form values from a record in a database (MySQL) so that the info can be updated. i.e. How do you restore the submitters original choices on a form? <value=<?$fieldname?>/> ? How can you re-select items in a dropdown menu? Thanks for any advice, code examples or tutorials locations. Virgil
I'm looking for an old post that I saw, and now cant seem to find, concerning how to reset complicated form values from a record in a database (MySQL) so that the info can be updated. i.e. How do you restore the submitters original choices on a form? <value=<?$fieldname?>/> ? How can you re-select items in a dropdown menu? Thanks for any advice, code examples or tutorials locations. Virgil
On the SELECT OPTION that you want to be selected enter
in the OPTION tag.
Compare the select values against that submitted and when you have a match enter the above code.
Code: Select all
<OPTION VALUE="this" SELECTED>This text</OPTION>Compare the select values against that submitted and when you have a match enter the above code.
- RandomEngy
- Forum Contributor
- Posts: 173
- Joined: Wed Jun 26, 2002 3:24 pm
- Contact:
Basically, you want to insert the database value where the default value of the form is.
Just load the data you want from the database and put it in a variable, and use it in those places.
Code: Select all
<input type="text" name="mytext" value="<?=$phpvariable?>">
...
<option value="An option"<? if($myvar == 5) echo(" selected"); ?>>
...
<textarea name="frank"><?=$anotherphpvariable?></textarea>
...
<input type="radio" name="myradiogroup" value="34"<? if($phpvar == 12) echo(" checked"); ?>>