ส่งแบบ POST ไปยัง user1.php
เอาโค้ดแค่ส่วนที่คิดว่าต้องใช้งานมานะคะ
$group = $_POST['group[]'];
for($i=0;$i<count($group);$i++){
echo $group[$i];
echo "<br>";
}
$sql = "insert into user (`type`,company_id,username,`password`,password_encrypt,name,email,date,time,status) values ('$ty','$ci','$username','$password','$password_en','$name','$email','$date','$time','$st')";
echo $sql;
$result = mysql_query($sql);
$count1 = count($group);
$sql2 = "insert into user (`group`) values ('$group[$count1]')";
if(!$result){
die('Failed to insert: '. mysql_error());
exit;
}
มันขึ้นแบบนี้คะ
Notice: Undefined index: group[] in C:\wamp\www\user1.php on line 35
ADMIN
insert into user (`type`,company_id,username,`password`,password_encrypt,name,email,date,time,status) values ('ADMIN','13','zzzzzz','qerd','b773e0021751f36e9b11a2b4a9315ae8','gsgd','cfcvc','2010-11-01','10:50:13','1')
$sql = "insert into user (`type`,company_id,`group`,username,`password`,password_encrypt,name,email,date,time,status) values ('$ty','$ci','$group','$username','$password','$password_en','$name','$email','$date','$time','$st')";
for($i=0;$i<=count($array[]);$i++){
$sql="INSERT INTO table_name VALUES('field1','field1','field1','field1')";
mysql_query($sql) or die (mysql_error());
}