Re: Remembering which option in a SELECT tag the user had chosen
| From: | Paul | Date: | Thu, 30 Jan 2003 18:47:16 +0000 |
| Subject: | Re: Remembering which option in a SELECT tag the user had chosen | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-133619@lists.php.net to get a copy of this message | ||
Inside HTML code, parsed as php, in a select, I've been using the below. It's a bit longer
than your plan to use arrays, but it works fine.
<select name="country">
<option value="">-- Select a country --</option>
<option value="USA" <?php if ($country == 'USA') { echo "
selected"; } ?>>United States</option>
<option value="AFG" <?php if ($country == 'AFG') { echo "
selected"; }
?>>Afghanistan</option>
and so forth....