Accessing multiple submitted values : Form Data « Form « PHP






Accessing multiple submitted values

 
<form method="POST" action="index.php">
<select name="lunch[]" multiple>
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
<option value="d">D</option>
<option value="e">E</option>
</select>
<input type="submit" name="submit">
</form>
Selected buns:
<br/>
<?php
foreach ($_POST['lunch'] as $choice) {
    print "You want a $choice bun. <br/>";
}
?>
  
  








Related examples in the same category

1.Deal with Array Form Data
2.A process_form() Function
3.Access widget's form value
4.Calculation based on form data
5.Forms and PHP
6.Feedback Form
7.Handling Special Characters
8.multivalue-forms.php
9.Saying "Hello"