<form action="#" method="post">
<input type="checkbox" name="box[]" value="C/C++"><label>C/C++</label><br/>
<input type="checkbox" name="box[]" value="Java"><label>Java</label><br/>
<input type="checkbox" name="box[]" value="PHP"><label>PHP</label><br/>
<input type="submit" name="submit" value="Submit"/>
</form>
I am using php code to fetch checked box values, how can I save each checked values in different variable out of loop?
<?php
if(isset($_POST['submit'])){
if(!empty($_POST['box'])){
foreach($_POST['box'] as $selected){
echo $selected."</br>";
}
}
}
?>