multiple selections to input variables
| From: | Terry Romine | Date: | Thu, 18 Jul 2002 15:18:46 +0000 |
| Subject: | multiple selections to input variables | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-20622@lists.php.net to get a copy of this message | ||
I have a form with a multi-line select field:
<select name="cities" size="5" multiple>
<? $sql="select City from table group by City"
;
$result = mysql_query($sql) or die($sql . mysql_error());
while($row=mysql_fetch_object($result)) {
$city = $row->City;
$cityCode = strtolower(eregi_replace(" ","_", $city));
$cityName = ucwords(strtolower($city));
echo("<OPTION value='$cityCode'>$cityName</OPTION>");
}
}
?>
</SELECT>and I am trying to read the multiple selections on the process form, but only "seeing" the last selected item. [ sample parameter list based on get method ] filename.php?cities=waterford&cities=winton&cities=woodbridge [snip] if($cities) { // multiple may be selected -- figure that out later die("multiple cities: $cities"); // results in displaying 'multiple cities: woodbridge' } [snip] I'm using PHP and MYSQL to hold the results. Terry