<?php include ("./config.php"); for($i=0;$i<count($_POST);$i++){ $mysql->query(" INSERT INTO item_price SET title = %s, price = %s ", array( $_POST['Opt_title'][$i], $_POST['Opt_price'][$i] ) ); } ?> <form method="post"> <?php for($i=0; $i<4; $i++) { echo "สินค้า : <input type=text name=\"Opt_title[]\" size=38 > ราคา :<input type=text name=\"Opt_price[]\" size=5 ><br/>"; } ?> <input type="submit"> </form>
<?php include ("./config.php"); // for($i=0;$i<count($_POST);$i++){ // วนลูปไม่รู้จบ for ($i = 0; $i < PHP_INT_MAX; $i++) { // ตรวจว่ามีข้อมูลตามค่า $i หรือไม่ if (!isset($_POST['Opt_title'][$i], $_POST['Opt_price'][$i])) { // ถ้าไม่มี แสดงว่าไม่มีข้อมูลส่งมา หรือข้อมูลครบแล้ว ก็ออกจากลูปซะ break; } $mysql->query(" INSERT INTO item_price SET title = %s, price = %s ", array( $_POST['Opt_title'][$i], $_POST['Opt_price'][$i] ) ); } ?> <form method="post"> <?php for($i=0; $i<4; $i++) { echo "สินค้า : <input type=text name=\"Opt_title[$i]\" size=38 > ราคา :<input type=text name=\"Opt_price[$i]\" size=5 ><br/>"; } ?> <input type="submit"> </form>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง