GORAGOD.com
freelance, web developer, web designer, hosting, domain name
Home
Host & Domain
Portfolio
ตรวจสอบ textbox
Home
Forum
ตรวจสอบ textbox
nutthavp
อาจารย์ครับ ผมมีฟอร์ม php มี input แบบ text ชื่อ item_name[1] จนถึง item_name[100] ตอนกรอกข้อมูลอาจจะกรอไม่ครบทั้ง 100 เช่นกรอกตั้ง 1-50 อยากทราบว่าโค๊ด php ที่จะตรวจสอบว่า input ตัวสุดท้ายที่กรอกค่ามาคือ item_name[?] ตัวที่เท่าไหร่จะเช็คยังไงครับ
goragod
<?php
// ตัวแปรเก็บ id สุดท้าย
$last_id = 0;
foreach($_POST['item_name'] AS $key => $value){
if ($value != '') {
$last_id = $key;
}
}
?>
nutthavp
ขอบคุณครับ
ความคิดเห็น
รายละเอียด
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 1024
^
// ตัวแปรเก็บ id สุดท้าย
$last_id = 0;
foreach($_POST['item_name'] AS $key => $value){
if ($value != '') {
$last_id = $key;
}
}
?>