An HTML Form Including a SELECT Element : Form Select « Form « PHP






An HTML Form Including a SELECT Element

<html>
<head>
<title>An HTML form including a SELECT element</title>
</head>
<body>
<form action="formSelectData.php" method="POST">
  <input type="text" name="user">
  <br>
  <textarea name="address" rows="5" cols="40"></textarea>
  <br>
  <select name="products[]" multiple>
    <option>option1
    <option>option2
    <option>option3
    <option>option4
  </select>
  <br>
  <input type="submit" value="OK">
</form>
</body>
</html>

<!-- formSelectData.php

<html>
<head>
<title>Reading input from the form</title>
</head>
<body>
<?php
print "Welcome <b>$user</b><p>\n\n";
print "Your address is:<p>\n\n<b>$address</b><p>\n\n";
print "Your product choices are:<p>\n\n";
print "<ul>\n\n";
foreach ( $products as $value ){
    print "<li>$value<br>\n";
}
print "</ul>";
?>
</body>
</html>


-->

           
       








Related examples in the same category

1.Form select input
2.A
3.A day choice
4.An HTML Form with a select Element
5.Validating a drop-down menu with in_array()
6.Displaying a
7.Generating a dynamic pull-down menu
8.Setting a default value in a
9.Setting defaults in a multi-valued
10.Creating Form Elements Based on the Current Time and/or Date
11.Creating Form Elements with Multiple Options
12.One choice for each day from 1 to 31
13.One choice for each year from last year to five years from now