 |
|
ผมสร้างตามนี้คาบเพื่อที่จะ insert ลงฐานข้อมูล โดยการ repeat ลงมา ชื่อ textbox = txt_detail ได้ตามรูปด้านล่าง

รันมาจะได้ดังนี้

อันเป็น code insert Code (PHP)
<?
mysql_connect("localhost","otop","1234") or die (mysql_error());
mysql_select_db("otop");
for($i=1;$i<=(int)($_POST["txt_detail"]);$i++)
{
$strSQL = "INSERT INTO product";
$strSQL .="(pd_tb_id,pd_nm_id,pd_detail) VALUES ('".$_POST["hd_nm"]."','".$_POST["sl_name"]."','".$_POST["txt_detail"]."')";
mysql_query($strSQL);
}
mysql_close();
?>
มีhidder field เพื่อกำหนดค่า id ของ pd_nm_idCode (PHP)
<?php echo $row_rs_table['pd_tb_id']; ?>
แต่พอ insert ไปแล้วข้อมูลมันลงแต่ textbox ล่างสุดคาบ ผมจะต้องแก้ตรงส่วนไหน ช่วยหน่อยคาบ

Tag : PHP, MySQL, HTML/CSS, JavaScript, Ajax, jQuery
|
ประวัติการแก้ไข 2012-01-27 00:08:36 2012-01-27 00:10:40
|
 |
 |
 |
 |
Date :
2012-01-27 00:06:01 |
By :
potkung11 |
View :
1285 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |