Depends on the type of input field. For the most part, you can simply set the
value attribute of an input field:
<input type="text" name="firstName" value="Nikolai" />
<input type="hidden" name="id" value="5" />
For radio buttons, you already set the value of each radio. To make sure one of them is checked, use the
checked attribute:
<input type="radio" name="gender" value="m" checked="true" />
<input type="radio" name="gender" value="f" />
For dropdown lists, you can preselect one (or more, if your dropdown is multiple) options by using the
selected attribute:
<select name="languages" multiple="yes">
<option value="English" selected="true">English</option>
<option value="Spanish" selected="true">Spanish</option>
<option value="French">French</option>
<option value="Greek" selected="true">Greek</option>
</select>
Now that you know the HTML required to pre-populate form fields, it shouldn't be too difficult to write the PHP to generate this.
Take care,
Nik
http://www.bigaction.org/