我想在数据库中插入选定的行,但我无法获得已选中的复选框。然而,在我的一个表格中,我正在更新记录,我可以得到数,但在这里,我无法做到。代码如下
<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());
}
}
}
答案 0 :(得分:0)
你可以这样试试
$studentIds = explode(' ', $_POST['ids']);
$totalId= count($studentIds);