Holding a value in a select box
Posted: Sun Aug 21, 2005 11:38 am
I have a form where values are retained in the form fields using:
This is used so that then any conditional statements throw and error any of the correctly entered fields will hold their content.
I also then have a dynamic select box
I have no real idea as to how to apply the same PHP code to hold a value that has also been selected. Can anyone fill me in on how this is done?
Thanks very much
Code: Select all
<input type="text" name="fullname" value="<?php if (isset($_POST['fullname'])) echo $_POST['fullname'];?>" size="32">I also then have a dynamic select box
Code: Select all
<?PHP echo "<select name='bedrooms' id='bedrooms'>\n
<option value='%'>Search All</option>";
while($dbRow = mysql_fetch_array($getBedrooms)){
echo "<option value='"
. $dbRow["bedrooms_details"]
. "'>"
. $dbRow["bedrooms_details"]
."</option>\n";
} echo "</select>\n";
?>I have no real idea as to how to apply the same PHP code to hold a value that has also been selected. Can anyone fill me in on how this is done?
Thanks very much