dbutler Posted August 4, 2008 Share Posted August 4, 2008 So I have created the following form in PHP/HTML: $query = "SELECT * FROM STATUS ORDER BY status";$result = mysql_query($query) or die ("Couldn't execute query.");echo " <td><select multiple size='10' name='status'>\n";while ($row = mysql_fetch_array($result)) { extract($row); echo "<option value='$status'>$status\n"; }echo "</select></td>\n"; now note that I am using "multiple" in the html select statement. Since this form data is collected via a POST with a name of 'select', how do I retrieve ALL of the items that were selected? Right now when I pick up the $_POST['status'] variable it only results in the last item selected. I'm sure there is an easy answer, I just can't seem to figure this out as I am a begining programmer. Thanks! drb Link to comment Share on other sites More sharing options...
justsomeguy Posted August 4, 2008 Share Posted August 4, 2008 Use array syntax with the name and you can access the list of values in PHP as an array.<select multiple size='10' name='status[]'> Link to comment Share on other sites More sharing options...
dbutler Posted August 4, 2008 Author Share Posted August 4, 2008 Got it, thanks! drb Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.