wordpress_add

Friday 10 January 2014

Get checkbox value in PHP

Get checkbox value in PHP



<form action="index.php" method="post">

 <input type="checkbox" name="language[]" value="php" />PHP<br /> 
<input type="checkbox" name="language[]" value="html" />HTML<br /> 
<input type="checkbox" name="language[]" value="java" />Java<br />
 <input type="checkbox" name="language[]" value="c++" />C++<br /> 
<input type="submit" value="send" />

 </form>


foreach($_POST['language'] as $value)
 {
    echo 'Checked: '.$value.' ';
 }

If you check all the checkboxes, this script will output: 

Checked: php
Checked: html
Checked: java
Checked: c++

Subscribe Dr-Wordpress for Important Knowledge of wordpress..your's suggestions are most welcomed.

No comments:

Post a Comment