multivalue-forms.php : Form Data « Form « PHP






multivalue-forms.php

 
<?php
   if (isset($_POST['submit']))
   {
      echo "You like the following languages:<br />";
      foreach($_POST['languages'] AS $language) echo "$language<br />";
   }
?>

<form action="index.php" method="post">
   Check all that apply): 
   <input type="checkbox" name="languages[]" value="csharp" />C#<br />
   <input type="checkbox" name="languages[]" value="jscript" />JavaScript<br />
   <input type="checkbox" name="languages[]" value="perl" />Perl<br />
   <input type="checkbox" name="languages[]" value="php" />PHP<br />
   <input type="submit" name="submit" value="Go!" />
</form>
  
  








Related examples in the same category

1.Deal with Array Form Data
2.A process_form() Function
3.Access widget's form value
4.Accessing multiple submitted values
5.Calculation based on form data
6.Forms and PHP
7.Feedback Form
8.Handling Special Characters
9.Saying "Hello"