I want to insert selected rows in the database but I am unable to get count of checked check-boxes. However in one of my form where I am updating records I could get count but here I couldn't. Code is as below
<tr class="odd gradeX">
<td>
<input type="checkbox" class="checkboxes" value="<?php echo $row['student_id']; ?>" name="ids[]" />
</td>
<td>
<?php echo $row['first_name']." ".$row['last_name'];?>
</td>
<td>
<?php echo $row['father_mobile'];?>
</td>
<td class="hidden-480">
<a href="mailto:<?php echo $row['email'];?>">
<?php echo $row['email'];?>
</a>
</td>
<td class="hidden-480">
<?php echo $row['address'];?>
</td>
<td class="center hidden-480">
<?php echo $row1['track_name'];?>
</td>
<td>
<?php echo $row2['level_name'];?>
</span>
</td>
</tr>
<?php
if(isset($_POST['move']))
{
echo "count is" . count($_POST["ids"]);
for($i=0; $i<count($_POST["ids"]); $i++){
echo $sql = "inset into tbl_student_batches set bacth_id='".$_POST['batch_id']."',student_id='".$_POST['ids']."'";
if (mysql_query($sql)) {
$msg = "Selected students moved to next batch successfully";
header("location:convert_level?msg=$msg");
}else{
$errmsg = ("Error while moving.". mysql_error());
}
}
}