Re: getting values from multiple select

From: Date: Thu, 14 Mar 2002 14:52:53 +0000
Subject: Re: getting values from multiple select
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-88510@lists.php.net to get a copy of this message
Ok, how about a code snipet since I seem to be blind this morning. The select box code: <select multiple="yes" name="groups" id="av"> <? $sql = "select groupID,groupName from groups order by groupName"; $result = mssql_query($sql,$connection); while($row = mssql_fetch_array($result)){ $groupID = $row["groupID"]; $groupName = $row["groupName"]; echo "<option value=\"$groupID\">$groupName</option>"; } ?> </select> On the next page I tried the code Erik recommended doing this: foreach ($groups as $group_list){ echo $group_list; } Any eye openers? Thanks, -Scott On Thu, 14 Mar 2002, Erik Price wrote: > Hm... have you tried using a loop to get their values, rather than using > the numeric indexes? Like this: > > foreach ($choice as $array_element) { > echo $array_element; > }

« previous php.general (#88510) next »