<html>
<input type='checkbox' id='1' name='checkMr[]' value='1' />
<input type='checkbox' id='2' name='checkMr[]' value='2' />
<input type='checkbox' id='3' name='checkMr[]' value='3' />
<input type='checkbox' id='4' name='checkMr[]' value='4' />
<a id="savedoctorschedule" style="float: right;" class="clyes clbutton clbtnSave">Save</a>
</html>
<script>
$j("#savedoctorschedule").bind("click", function () {
$j.ajax({
url: "schedulemr.php",
type: "post",
data: { schmrid: $j("#sel_mr").val(),
schedocid: $j("#checkMr[]").val(),
schedate: $j("#date1").val(), },
success:function(response){
}
</script>
<?php
include '../includes/include.php';
$schmrid = $_POST['sel_mr'];
$schedate = $_POST['date1'];
$schedocid = $_POST['checkMr'];
foreach($schedocid as $a => $b)
{
$sql="INSERT INTO tbl_mr_schedule(doctor_idscheduled_date)
VALUES ('".$schedocid[$a]."','".$schmrid."','0','".$date."','".$schedate."');";
mysql_query($sql) or die(mysql_error());
}
header('Location:../visitplan/');
?>
我想要使用 jQuery 选中复选框的所有 id;复选框可能是n
数字。我想在数据库中插入选中复选框的值,其中记录数将取决于选中复选框的数量。这将使用 PHP 作为服务器端脚本。
我该如何解决?