Hi, I am new to PHP. I am following this tutorial on how to use PHP and Forms.
My HTML Form looks like this:
<form id="A Form with SELECT" action="listing9.4.php" method="post" name="A Form with SELECT">
<b>Name:<br>
<input type="text" name="user" value="Enter your name here..." size="24" tabindex="1"></b>
<p><b>Address:<br>
<textarea name="address" rows="5" cols="40" tabindex="2">Enter your address here...</textarea></b></p>
<p><b>Select Some Products:<br>
<select name="products[]" size="4" multiple tabindex="3">
<option value="HP iPAQ H6325">HP iPAQ H6325</option>
<option value="Two-way Flight to California">Two-way Flight to California</option>
<option value="All expenses paid vacation">All expenses paid vacation</option>
<option value="Digital Camera">Digital Camera</option>
</select></b></p>
<p><button name="send" value="send" type="submit" tabindex="4">Send</button></p>
</form>
and my PHP code looks like this:
<p>
<?php
echo "<p>Welcome <b>$_POST[user]</b></p>";
echo "<p>Your address is:<br><b>$_POST[address]</b></p>";
echo "<p>Your product choices are:<br>";
if (!empty($_POST[products])){
echo "<ul>";
foreach ($_POST[products] as $value){
echo "<li>$value";
}
echo "</ul>";
} else {
echo "You have not selected any products.";
}
echo "</p>";
?>
</p>
Everything works fine except for the SELECT element. Here is an example of the output I get:
Welcome Russ Waters
Your address is:
182 Memphis Road Atlantis, Atlantais
Your product choices are:
Notice: Use of undefined constant products - assumed 'products' in F:\WEBROOT\public\main\PHP\Forms\listing9.4.php on line 19
Notice: Use of undefined constant products - assumed 'products' in F:\WEBROOT\public\main\PHP\Forms\listing9.4.php on line 21
* HP iPAQ H6325
* Two-way Flight to California
* All expenses paid vacation
* Digital Camera[/quote]
Those "Notices" are what I am wondering about. What am I doing wrong?