How to get multiple selected checkbox value in php

How to receive multiple selected checkbox values using php.

Here in this tutorial we are accessing multiple check box item values on single selection. So here is the complete step by step tutorial for How to get multiple selected checkbox value in php.

How to get multiple selected checkbox value in php.

android-project-download-code-button
Code for get-multiple-selected-checkbox-value-php.php file.

 <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Get multiple selected checkbox value in php</title>
</head>

<body>

<h2>Get multiple selected checkbox value in php.</h2>
 <form method="post" action="">
 <input type="checkbox" name="checkbox[]" value="ONE"><label>ONE</label><br/>
 <input type="checkbox" name="checkbox[]" value="TWO"><label>TWO</label><br/>
 <input type="checkbox" name="checkbox[]" value="THREE"><label>THREE</label><br/>
 <input type="checkbox" name="checkbox[]" value="FOUR"><label>FOUR</label><br/>
 <input type="checkbox" name="checkbox[]" value="FIVE"><label>FIVE</label><br/><br/>
 <input type="submit" name="submit" Value="submit">
 </form>
</br>

<?php
if (isset($_POST['submit']))
{
 $chkbox = $_POST['checkbox'];
 $i = 0;
 While($i < sizeof($chkbox))
 {
 
 echo "CheckBox checked Values are = " . $chkbox[$i] . '</br>';
 
 $i++;
 }
 
 }
 
 ?>


</body>
</html>

Screenshot:

How to get multiple selected checkbox value in php

Click here to download How to get multiple selected checkbox value in php project file with source code.

Leave a Reply

Your email address will not be published. Required fields are marked *