How to get multiple checked checkbox value in php

Retrieve more then one checkbox checked value using php and show on screen using echo.

Here multiple checkbox means more then one check boxes because on a very large scale complex website there are multiple choices according to category of each user. So here we are making 5 checkbox and provide the facility to user that he can select more then one choices. So here is the complete step by step tutorial for How to get multiple checked checkbox value in php.

android-project-download-code-button

How to get multiple checked checkbox value in php.

Code for get-multiple-checked-checkbox-data.php file.

 <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>How to get multiple checked checkbox value in php</title>
</head>

<body>

<h2>Get multiple checked checkbox value in php.</h2>
 <form method="post" action="">
 <input type="checkbox" name="checkbox[]" value="Android"><label>Android</label><br/>
 <input type="checkbox" name="checkbox[]" value="Android Studio"><label>Android Studio</label><br/>
 <input type="checkbox" name="checkbox[]" value="SDK Manager"><label>SDK Manager</label><br/>
 <input type="checkbox" name="checkbox[]" value="PHP"><label>PHP</label><br/>
 <input type="checkbox" name="checkbox[]" value="PHP Basics"><label>PHP Basics</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 checked checkbox value in php

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

Leave a Reply

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