<<< Previous question <<< Question ID#0276.md >>> Next question >>>
You have been given the following PHP script:
<?php
if ($_POST) {
echo '<pre>';
echo htmlspecialchars(print_r($_POST, true));
echo '</pre>';
}
?>
<form action="action.php" method="post">
Name: <input type="text" name="personal[name]" />
Email: <input type="text" name="personal[email]" />
Code:
// ???
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>
<input type="submit" value="submit me!" />
</form>
Which of the following is the correct syntax that should be used in line number 10 to capture all of the data from the user in PHP?
- A)
<select multiple name="select_box[]">
- B)
<select multiple name="select_box=array()">
- C)
<select multiple name="select_box[multiple]">
- D)
<select multiple name="select_box">
Answer
Answer: A