My simple HTML script below uses SELECT to create a list which should be accessed by the PHP script as an array. Note the products[]
definition below.
BUT.... I can't seem to get the script to read the array from$_POST
- anyone know how to solve this?
<HTML>
<TITLE>Input Form2</TITLE>
<FORM method="POST" action="FormRead2.php">
<BR>Name:<BR>
<INPUT type="text" name="user">
<BR>Address:<BR>
<TEXTAREA name="address" rows="5" cols="40">
</TEXTAREA>
<BR>Products:<BR>
<SELECT name "products[]" multiple>
<option>SFone
<option>CTI Desktop
<option>Real-Time Monitor
</SELECT>
<BR>
<INPUT type="submit" name="submit" value="Submit">
</FORM>
</HTML>
And here is the simple PHP script:
<HTML>
<TITLE>Action Script for InputForm2</TITLE>
<?php
if(isset($_POST)) {
echo "Welcome <b>".$_POST."</b><P>\n\n";
echo "Your address is:<P>\n\n<b>".$_POST."</b><p>\n\n";
echo "Your product choices are:<p>\n\n";
echo "<UL>\n\n";
foreach($_POST as $value) {
echo "<LI>$value<BR>\n";
}
echo "</UL>";
}
?>
</HTML>