News:

Choose a design and let our professionals help you build a successful website   - ITAcumens

Main Menu

PHP » Form » Form Select

Started by VelMurugan, Apr 10, 2009, 12:49 PM

Previous topic - Next topic

VelMurugan

Form select input

<HTML>
<HEAD>
<TITLE>Candy preference form</TITLE>
</HEAD>
   
<BODY>
<FORM ACTION="SelectFormControlHandler.php" METHOD="POST">
What's your most favorite kind of candy?<BR>
<INPUT TYPE="radio" NAME="Candy" VALUE="peanut butter cups">Peanut butter cups<BR>
<INPUT TYPE="radio" NAME="Candy" VALUE="Snickers">Snickers<BR>
<INPUT TYPE="radio" NAME="Candy" VALUE="Turtles">Turtles<BR>
<INPUT TYPE="submit">
</FORM>
</BODY>
</HTML>


<!-- SelectFormControlHandler.php
<HTML>
<HEAD>
<TITLE>Candy preference reply</TITLE>
</HEAD>
   
<BODY>
Yum, <?php print("$Candy!  ");
if(
$Candy == "peanut butter cups"){
  print(
"peanut butter cups");
  print(
$Candy.");
}else{
  print(
"$Candy");
  if(
$Candy == "Snickers"){
    print(
"Snickers");
  }elseif(
$Candy == "Turtles"){
    print(
"Turtles");
  }
}
?>

</BODY>
</HTML>
-->


Source : java2s

VelMurugan

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>


-->