How to Get/Send Multiple checkbox selected value in php to another page

How to get value from checkbox and pass the marked value to next page where you receive it using $_post method.

In this tutorial we are creating multiple check box using input type=”checkbox” and sending all the marked or we can say selected values the next action page where we receive all those values array using $_post method. So here is the complete step by step tutorial for How to Get/Send Multiple checkbox selected value in php to another page.

android-project-download-code-button

How to Get/Send Multiple checkbox selected value in php to another page.

Code for checkbox-send.php file.

 <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>How to Get/Send Multiple checkbox selected value in php to another page</title>
</head>

<body>

<h2>Pass checkbox marked value to next page.</h2>
 <form method="post" action="checkbox-receive.php">
 <input type="checkbox" name="chk[]" value="Android"><label>Android</label><br/>
 <input type="checkbox" name="chk[]" value="Android Studio"><label>Android Studio</label><br/>
 <input type="checkbox" name="chk[]" value="SDK Manager"><label>SDK Manager</label><br/>
 <input type="checkbox" name="chk[]" value="PHP"><label>PHP</label><br/>
 <input type="checkbox" name="chk[]" value="PHP Basics"><label>PHP Basics</label><br/><br/>
 <input type="submit" name="submit" Value="submit">
 </form>


</body>
</html>

Code for checkbox-receive.php file.

 <?php

 $chkbox = $_POST['chk'];
 $i = 0;
 While($i < sizeof($chkbox))
 {
 echo "CheckBox Selected Values = " . $chkbox[$i] . '</br>';
 
 $i++;
 }
 
 ?>

Screenshots:

How to Get/Send Multiple checkbox selected value in php to another page

checkbox-receive

Click here to download How to Get/Send Multiple checkbox selected value in php to another page projects file with source code.

Leave a Reply

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