i have a php form which submits data to another php for validation. if any fields are left blank the validator php sends a message back to original php form along with all the pre filled variables using session variables so that user doesn’t have to fill them again.
i can use these session variables to fill in text boxes again like this
value="<?php echo $_SESSION['fname'] ?>"
but how to go about populating drop downs, radio buttons and check boxes?
thanks
A
<select>element’s selected<option>is not determined by it’svalue=attribute. In order to mark an option selected, the<option>element must have theselectedattribute set on it, as follows:In order to do this programmatically, you need to iterate through the options, and manually test for the correct option, and add
selectedto that.