This post is regarding my previous question continuation Bind values to checkbox
These Below code i have used in one of my php page
$Qualification=$_SESSION['Qualification']; // gives value = 1,2,3,
$selectedqualification= explode(",", $Qualification);
$selectedqualification= array_filter($selected);
Now these values are used to bind into checkbox-
<?php $query = "SELECT * FROM Qualification";
$result = mysqli_query($dbcon,$query);
while($row=mysqli_fetch_array($result)){
?>
<input type='checkbox' value='"<?php $row['Id'] ?> "' name='Qualification[]' <?php if (in_array($row['Id'], $selectedqualification)){ echo "checked"; } ?> /><?php echo $row['Description'] ?><br>
<?php } ?>
The Output of these will be displayed as
[/]Teacher
[/]ENgineer
[/]Doctor
[]Banker
Where the three values are checked .
Now on submit of the button using method post in the form
if(isset($_POST['submit']))
{
$AllQualification="";
print_r($_POST['Qualification']);
foreach($_POST['Qualification'] as $Qualification)
{
$AllQualification .=$Qualification.",";
}
echo $AllQualification
}
The output will be
Array ( [0] => " " [1] => " " [2] => " " [3] => " ")
'" "," "," "
Values are not getting passed to the array. How to get the values to bind to array? Any help appreciated.