×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: jaid int
Added: Dec 14, 2016 4:52 AM
Modified: Dec 14, 2016 5:09 PM
Views: 18
Tags: checkbox form
  1. <form method="post" action="check.frm.php">
  2.           Monday: <input type="checkbox" name="day[one]" value="Monday"/><br>
  3.           Tueseday:<input type="checkbox" name="day[two]" value="Tueseday"/><br>
  4.           Wednseday:<input type="checkbox" name="day[three]" value="Wednseday"/><br>
  5.         <input type="submit" value="submit"/>
  6. </form>
  7.  
  8.  
  9.  
  10. if(isset($_POST["day"])){
  11.          
  12.     $day1 = ( array_key_exists("one", $_POST["day"]) ? $_POST["day"]["one"] : NULL ) ;
  13.      $day2 = ( array_key_exists("two", $_POST["day"]) ? $_POST["day"]["two"] : NULL ) ;
  14.      $day3 = ( array_key_exists("three", $_POST["day"]) ? $_POST["day"]["three"] : NULL ) ;
  15.            
  16.            
  17.        echo "Today is ".   $day1       ."<br>";
  18.        echo "Today is ".    $day2        ."<br>";
  19.        echo "Today is ".     $day3        ."<br>";
  20. }