Thought of putting a code to illustrate handling multiple select menus with php.
Note the square brackets and the multiple="multiple" part in the form.
HTML form
---------
<form action="some_action_file.php" method="post">
<select name="select_name[]" multiple="multiple">
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
<option value="d">d</option>
</select>
<input type="submit" value="Submit" />
</form>
PHP part
----------
<?php ## some_action_file.php foreach ($_POST['select_name'] as $select_name){ echo "$select_name<br />"; ## prints all the selected values; one per line } ?>
Monday, January 22, 2007
Subscribe to:
Post Comments (Atom)
4 comments:
Post a Comment