เก็บข้อมูลเบิ้ล ช่วยดูให้หน่อยค่ะ

ต้องเก็บตามจำนวนแถวที่ check box ค่ะ
ตอนนี้เบิ้ลรายการละ 32 แถวค่ะ ช่วยดูให้ด้วยค่ะ


CODE หน้า form  -  Code (PHP)

<?
include("connect_sql.php") ;
$strSQL = "SELECT  * FROM mytable";
$objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mssql_fetch_array($objQuery))
{
?>

<?=$objResult["A1"]?><input type=checkbox name="A1[]" value=<?=$objResult["A1"]?>>
<?=$objResult["A2"]?><input type=checkbox name="A2[]" value=<?=$objResult["A2"]?>>
<?=$objResult["A3"]?><input type=checkbox name="A3[]" value=<?=$objResult["A3"]?>>

<?
}
?>

<input type="submit" name="btn" value="Save">




code เก็บข้อมูล  -  Code (PHP)

<?php
include("conn.php") ;

if($_POST['btn']){

        foreach($_POST['A1'] as $A1)
        foreach($_POST['A2'] as $A2)    
    foreach($_POST['A3'] as $A3)    
{

$sql2 = "insert into score
values (null , '$A1' , '$A2' , '$A3')";
$sqlquery2=mysql_db_query($dbname, $sql2);

print "<br><center><span clASs=style3>Successfully...</span></center><br>";
print "<meta http-equiv=refresh content=1;URL=employeelist.php?DepartmentCode=$DepartmentCode>";

}//if
}//foreach

?>
แสดงความคิดเห็น
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่