RE: [PHP] Redisplaying information from a HTML form
| From: | Jim Moseby | Date: | Thu, 11 Aug 2005 12:48:23 +0000 |
| Subject: | RE: [PHP] Redisplaying information from a HTML form | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-220417@lists.php.net to get a copy of this message | ||
> Is there a way I can make these boxes and buttons
> retain their value?
Without a code example, I am forced to give a generic answer. Here's one
way to do it:
<?
$selection=5; // User previously picked option 5
$ddselection[$selection]=' selected ';
?>
<select name="D1">
<option<? echo $ddselection[1]; ?> value="1">Option 1</option>
<option<? echo $ddselection[2]; ?> value="2">Option 2</option>
<option<? echo $ddselection[3]; ?> value="3">Option 3</option>
<option<? echo $ddselection[4]; ?> value="4">Option 4</option>
<option<? echo $ddselection[5]; ?> value="5">Option 5</option>
<option<? echo $ddselection[6]; ?> value="6">Option 6</option>
<option<? echo $ddselection[7]; ?> value="7">Option 7</option>
<option<? echo $ddselection[8]; ?> value="8">Option 8</option>
</select>
JM