Checkbox ส่งค่าไปแต่ละหน้า
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา Checkbox ส่งค่าไปแต่ละหน้า
Checkbox ส่งค่าไปแต่ละหน้า
Copy
ต่อจากอันนี้นะครับ
https://www.ninenik.com/forum_view_1205_1.html
https://www.ninenik.com/forum_view_1205_1.html
ผมลองแล้วอะครับ พี่ นิก
มีตัวอย่างแบบ ง่ายกว่านี้ไหม่ครับ ผมทำแบบแยกหน้าอะครับ เลยไม่รุ้จาไส่ยังไง พอ save ข้อมูลเสร็จ เหมือนมัน
ไม่สามารถส่งค่าไปได้ครับ
step เหมือนด้านบน เลยครับแต่ที่เพิ่มมา คือ
อันนี้คือหน้าแรกของแต่ละแผนกว่า ไม่ได้ใช้ข้ออะไรบ้าง
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="1save.php">
<p>
<input type="checkbox" name="checkbox" id="checkbox" />
แผนก1(ไม่ได้ทำข้อที่ 2 3 4)</p>
<p>
<input type="checkbox" name="checkbox2" id="checkbox2" />
แผนก2 (ไม่ได้ทำข้อที่ 1 3 4)</p>
<p>
<input type="checkbox" name="checkbox3" id="checkbox3" />
แผนก3 (ไม่ได้ทำข้อที่ 2 3 4 5 6)</p>
<p>
<input type="checkbox" name="checkbox4" id="checkbox4" />
แผนก4 (ไม่ได้ทำข้อที่ 6 7 8 9)</p>
<p>
<input type="checkbox" name="checkbox5" id="checkbox5" />
แผนก5 (ไม่ได้ทำข้อที่ 2 4 5)</p>
<p>
<input type="submit" name="button" id="button" value="Submit" />
</p>
</form>
</body>
</html>
และหน้า save ของแต่ละหน้าจะเป็นประมานนี้ครับ คือมีการตั้ง ใน Refresh ไปอีกหน้า
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=2.php'>
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
ส่วนหน้าที่ 2 นี้ มาจากหน้าแรกครับ ที่แต่ละแผนกไม่ได้ใช้อะไรบ้างให้ Disbled เลย
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="2save.php">
<p>
<input type="checkbox" name="checkbox" id="checkbox" />
1
<input type="radio" name="radio" id="radio" value="radio" />
<input type="radio" name="radio" id="radio2" value="radio" />
<input type="radio" name="radio" id="radio3" value="radio" />
<input type="radio" name="radio" id="radio4" value="radio" />
<input type="radio" name="radio" id="radio5" value="radio" />
<input type="radio" name="radio" id="radio6" value="radio" />
<input type="radio" name="radio" id="radio7" value="radio" />
<input type="radio" name="radio" id="radio8" value="radio" />
<input type="radio" name="radio" id="radio9" value="radio" />
<input type="radio" name="radio" id="radio10" value="radio" />
Page
4.1</p>
<p>
<input type="checkbox" name="checkbox2" id="checkbox2" />
2
<input type="radio" name="radio" id="radio11" value="radio" />
<input type="radio" name="radio" id="radio12" value="radio" />
<input type="radio" name="radio" id="radio13" value="radio" />
<input type="radio" name="radio" id="radio14" value="radio" />
<input type="radio" name="radio" id="radio15" value="radio" />
<input type="radio" name="radio" id="radio16" value="radio" />
<input type="radio" name="radio" id="radio17" value="radio" />
<input type="radio" name="radio" id="radio18" value="radio" />
<input type="radio" name="radio" id="radio19" value="radio" />
<input type="radio" name="radio" id="radio20" value="radio" />
Page 4.2</p>
<p>
<input type="checkbox" name="checkbox3" id="checkbox3" />
3
<input type="radio" name="radio" id="radio21" value="radio" />
<input type="radio" name="radio" id="radio22" value="radio" />
<input type="radio" name="radio" id="radio23" value="radio" />
<input type="radio" name="radio" id="radio24" value="radio" />
<input type="radio" name="radio" id="radio25" value="radio" />
<input type="radio" name="radio" id="radio26" value="radio" />
<input type="radio" name="radio" id="radio27" value="radio" />
<input type="radio" name="radio" id="radio28" value="radio" />
<input type="radio" name="radio" id="radio29" value="radio" />
<input type="radio" name="radio" id="radio30" value="radio" />
Page 4.3</p>
<p>
<input type="checkbox" name="checkbox4" id="checkbox4" />
4
<input type="radio" name="radio" id="radio31" value="radio" />
<input type="radio" name="radio" id="radio32" value="radio" />
<input type="radio" name="radio" id="radio33" value="radio" />
<input type="radio" name="radio" id="radio34" value="radio" />
<input type="radio" name="radio" id="radio35" value="radio" />
<input type="radio" name="radio" id="radio36" value="radio" />
<input type="radio" name="radio" id="radio37" value="radio" />
<input type="radio" name="radio" id="radio38" value="radio" />
<input type="radio" name="radio" id="radio39" value="radio" />
<input type="radio" name="radio" id="radio40" value="radio" />
Page 4.4</p>
<p>
<input type="checkbox" name="checkbox5" id="checkbox5" />
5
<input type="radio" name="radio" id="radio41" value="radio" />
<input type="radio" name="radio" id="radio42" value="radio" />
<input type="radio" name="radio" id="radio43" value="radio" />
<input type="radio" name="radio" id="radio44" value="radio" />
<input type="radio" name="radio" id="radio45" value="radio" />
<input type="radio" name="radio" id="radio46" value="radio" />
<input type="radio" name="radio" id="radio47" value="radio" />
<input type="radio" name="radio" id="radio48" value="radio" />
<input type="radio" name="radio" id="radio49" value="radio" />
<input type="radio" name="radio" id="radio50" value="radio" />
Page 4.5</p>
<p>
<input type="checkbox" name="checkbox6" id="checkbox6" />
6
<input type="radio" name="radio" id="radio51" value="radio" />
<input type="radio" name="radio" id="radio52" value="radio" />
<input type="radio" name="radio" id="radio53" value="radio" />
<input type="radio" name="radio" id="radio54" value="radio" />
<input type="radio" name="radio" id="radio55" value="radio" />
<input type="radio" name="radio" id="radio56" value="radio" />
<input type="radio" name="radio" id="radio57" value="radio" />
<input type="radio" name="radio" id="radio58" value="radio" />
<input type="radio" name="radio" id="radio59" value="radio" />
<input type="radio" name="radio" id="radio60" value="radio" />
Page 4.6</p>
<p>
<input type="checkbox" name="checkbox7" id="checkbox7" />
7
<input type="radio" name="radio" id="radio61" value="radio" />
<input type="radio" name="radio" id="radio62" value="radio" />
<input type="radio" name="radio" id="radio63" value="radio" />
<input type="radio" name="radio" id="radio64" value="radio" />
<input type="radio" name="radio" id="radio65" value="radio" />
<input type="radio" name="radio" id="radio66" value="radio" />
<input type="radio" name="radio" id="radio67" value="radio" />
<input type="radio" name="radio" id="radio68" value="radio" />
<input type="radio" name="radio" id="radio69" value="radio" />
<input type="radio" name="radio" id="radio70" value="radio" />
Page 4.7</p>
<p>
<input type="checkbox" name="checkbox8" id="checkbox8" />
8
<input type="radio" name="radio" id="radio71" value="radio" />
<input type="radio" name="radio" id="radio72" value="radio" />
<input type="radio" name="radio" id="radio73" value="radio" />
<input type="radio" name="radio" id="radio74" value="radio" />
<input type="radio" name="radio" id="radio75" value="radio" />
<input type="radio" name="radio" id="radio76" value="radio" />
<input type="radio" name="radio" id="radio77" value="radio" />
<input type="radio" name="radio" id="radio78" value="radio" />
<input type="radio" name="radio" id="radio79" value="radio" />
<input type="radio" name="radio" id="radio80" value="radio" />
</p>
<p>
<input type="checkbox" name="checkbox9" id="checkbox9" />
9
<input type="radio" name="radio" id="radio81" value="radio" />
<input type="radio" name="radio" id="radio82" value="radio" />
<input type="radio" name="radio" id="radio83" value="radio" />
<input type="radio" name="radio" id="radio84" value="radio" />
<input type="radio" name="radio" id="radio85" value="radio" />
<input type="radio" name="radio" id="radio86" value="radio" />
<input type="radio" name="radio" id="radio87" value="radio" />
<input type="radio" name="radio" id="radio88" value="radio" />
<input type="radio" name="radio" id="radio89" value="radio" />
<input type="radio" name="radio" id="radio90" value="radio" />
</p>
<p>
<input type="checkbox" name="checkbox10" id="checkbox10" />
10
<input type="radio" name="radio" id="radio91" value="radio" />
<input type="radio" name="radio" id="radio92" value="radio" />
<input type="radio" name="radio" id="radio93" value="radio" />
<input type="radio" name="radio" id="radio94" value="radio" />
<input type="radio" name="radio" id="radio95" value="radio" />
<input type="radio" name="radio" id="radio96" value="radio" />
<input type="radio" name="radio" id="radio97" value="radio" />
<input type="radio" name="radio" id="radio98" value="radio" />
<input type="radio" name="radio" id="radio99" value="radio" />
<input type="radio" name="radio" id="radio100" value="radio" />
</p>
<p>อันไหนที่หน้านี้ Disbled หน้าที่ 3 ต้อง Disbled ด้วย</p>
<p>
<input type="submit" name="button" id="button" value="Submit" />
</p>
</form>
</body>
</html>
save หน้า 2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=3.php'>
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
ส่วนหน้าที่ 3 ก็เหมือนหน้าที่ 2 คือ หน้าที่ 2 Disbled ยังไง ก็แบบนั้นครับ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="2save.php">
<p>
<input type="checkbox" name="checkbox" id="checkbox" />
1
<input type="radio" name="radio" id="radio" value="radio" />
<input type="radio" name="radio" id="radio2" value="radio" />
<input type="radio" name="radio" id="radio3" value="radio" />
<input type="radio" name="radio" id="radio4" value="radio" />
<input type="radio" name="radio" id="radio5" value="radio" />
<input type="radio" name="radio" id="radio6" value="radio" />
<input type="radio" name="radio" id="radio7" value="radio" />
<input type="radio" name="radio" id="radio8" value="radio" />
<input type="radio" name="radio" id="radio9" value="radio" />
<input type="radio" name="radio" id="radio10" value="radio" />
Page
4.1</p>
<p>
<input type="checkbox" name="checkbox2" id="checkbox2" />
2
<input type="radio" name="radio" id="radio11" value="radio" />
<input type="radio" name="radio" id="radio12" value="radio" />
<input type="radio" name="radio" id="radio13" value="radio" />
<input type="radio" name="radio" id="radio14" value="radio" />
<input type="radio" name="radio" id="radio15" value="radio" />
<input type="radio" name="radio" id="radio16" value="radio" />
<input type="radio" name="radio" id="radio17" value="radio" />
<input type="radio" name="radio" id="radio18" value="radio" />
<input type="radio" name="radio" id="radio19" value="radio" />
<input type="radio" name="radio" id="radio20" value="radio" />
Page
4.2</p>
<p>
<input type="checkbox" name="checkbox3" id="checkbox3" />
3
<input type="radio" name="radio" id="radio21" value="radio" />
<input type="radio" name="radio" id="radio22" value="radio" />
<input type="radio" name="radio" id="radio23" value="radio" />
<input type="radio" name="radio" id="radio24" value="radio" />
<input type="radio" name="radio" id="radio25" value="radio" />
<input type="radio" name="radio" id="radio26" value="radio" />
<input type="radio" name="radio" id="radio27" value="radio" />
<input type="radio" name="radio" id="radio28" value="radio" />
<input type="radio" name="radio" id="radio29" value="radio" />
<input type="radio" name="radio" id="radio30" value="radio" />
Page
4.3</p>
<p>
<input type="checkbox" name="checkbox4" id="checkbox4" />
4
<input type="radio" name="radio" id="radio31" value="radio" />
<input type="radio" name="radio" id="radio32" value="radio" />
<input type="radio" name="radio" id="radio33" value="radio" />
<input type="radio" name="radio" id="radio34" value="radio" />
<input type="radio" name="radio" id="radio35" value="radio" />
<input type="radio" name="radio" id="radio36" value="radio" />
<input type="radio" name="radio" id="radio37" value="radio" />
<input type="radio" name="radio" id="radio38" value="radio" />
<input type="radio" name="radio" id="radio39" value="radio" />
<input type="radio" name="radio" id="radio40" value="radio" />
Page
4.4</p>
<p>
<input type="checkbox" name="checkbox5" id="checkbox5" />
5
<input type="radio" name="radio" id="radio41" value="radio" />
<input type="radio" name="radio" id="radio42" value="radio" />
<input type="radio" name="radio" id="radio43" value="radio" />
<input type="radio" name="radio" id="radio44" value="radio" />
<input type="radio" name="radio" id="radio45" value="radio" />
<input type="radio" name="radio" id="radio46" value="radio" />
<input type="radio" name="radio" id="radio47" value="radio" />
<input type="radio" name="radio" id="radio48" value="radio" />
<input type="radio" name="radio" id="radio49" value="radio" />
<input type="radio" name="radio" id="radio50" value="radio" />
Page
4.5</p>
<p>
<input type="checkbox" name="checkbox6" id="checkbox6" />
6
<input type="radio" name="radio" id="radio51" value="radio" />
<input type="radio" name="radio" id="radio52" value="radio" />
<input type="radio" name="radio" id="radio53" value="radio" />
<input type="radio" name="radio" id="radio54" value="radio" />
<input type="radio" name="radio" id="radio55" value="radio" />
<input type="radio" name="radio" id="radio56" value="radio" />
<input type="radio" name="radio" id="radio57" value="radio" />
<input type="radio" name="radio" id="radio58" value="radio" />
<input type="radio" name="radio" id="radio59" value="radio" />
<input type="radio" name="radio" id="radio60" value="radio" />
Page
4.6</p>
<p>
<input type="checkbox" name="checkbox7" id="checkbox7" />
7
<input type="radio" name="radio" id="radio61" value="radio" />
<input type="radio" name="radio" id="radio62" value="radio" />
<input type="radio" name="radio" id="radio63" value="radio" />
<input type="radio" name="radio" id="radio64" value="radio" />
<input type="radio" name="radio" id="radio65" value="radio" />
<input type="radio" name="radio" id="radio66" value="radio" />
<input type="radio" name="radio" id="radio67" value="radio" />
<input type="radio" name="radio" id="radio68" value="radio" />
<input type="radio" name="radio" id="radio69" value="radio" />
<input type="radio" name="radio" id="radio70" value="radio" />
Page
4.7</p>
<p>
<input type="checkbox" name="checkbox8" id="checkbox8" />
8
<input type="radio" name="radio" id="radio71" value="radio" />
<input type="radio" name="radio" id="radio72" value="radio" />
<input type="radio" name="radio" id="radio73" value="radio" />
<input type="radio" name="radio" id="radio74" value="radio" />
<input type="radio" name="radio" id="radio75" value="radio" />
<input type="radio" name="radio" id="radio76" value="radio" />
<input type="radio" name="radio" id="radio77" value="radio" />
<input type="radio" name="radio" id="radio78" value="radio" />
<input type="radio" name="radio" id="radio79" value="radio" />
<input type="radio" name="radio" id="radio80" value="radio" />
</p>
<p>
<input type="checkbox" name="checkbox9" id="checkbox9" />
9
<input type="radio" name="radio" id="radio81" value="radio" />
<input type="radio" name="radio" id="radio82" value="radio" />
<input type="radio" name="radio" id="radio83" value="radio" />
<input type="radio" name="radio" id="radio84" value="radio" />
<input type="radio" name="radio" id="radio85" value="radio" />
<input type="radio" name="radio" id="radio86" value="radio" />
<input type="radio" name="radio" id="radio87" value="radio" />
<input type="radio" name="radio" id="radio88" value="radio" />
<input type="radio" name="radio" id="radio89" value="radio" />
<input type="radio" name="radio" id="radio90" value="radio" />
</p>
<p>
<input type="checkbox" name="checkbox10" id="checkbox10" />
10
<input type="radio" name="radio" id="radio91" value="radio" />
<input type="radio" name="radio" id="radio92" value="radio" />
<input type="radio" name="radio" id="radio93" value="radio" />
<input type="radio" name="radio" id="radio94" value="radio" />
<input type="radio" name="radio" id="radio95" value="radio" />
<input type="radio" name="radio" id="radio96" value="radio" />
<input type="radio" name="radio" id="radio97" value="radio" />
<input type="radio" name="radio" id="radio98" value="radio" />
<input type="radio" name="radio" id="radio99" value="radio" />
<input type="radio" name="radio" id="radio100" value="radio" />
</p>
<p>Disbled ตามหน้าที่ 2</p>
<p>
<input type="submit" name="button" id="button" value="Submit" />
</p>
</form>
</body>
</html>
saveหน้า3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<META HTTP-EQUIV='Refresh' CONTENT = '0;URL=4.1.php'>
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
และเมื่อเสร็จสิ้นที่หน้า 3 ก็คล้าย ๆ ที่พี่นิก นำตัวอย่างมาให้เลยคับ คือที่ผมสร้างเปนตารางแยกหมดเลยครับ เลยงง ตรง For i ไม่รุ้จาใส่ยังไง
ดีทำให้มันเละอะครับ
ดีทำให้มันเละอะครับ
ในหน้าที่ 2 กับ 3 มี 10 ข้อ แต่มีข้อที่ 1-7 จะมีหน้าแยกไป 4.1 - 4.7
แล้วเมื่อ ข้อไหนถูก Disbled แล้ว จะให้ข้ามหน้านั้นไปครับ หน้า 4.1-4.7 ก็มีการ save ข้อมูลเหมือนกัน ทุก ๆ หน้าครับ
เอาวิธีบ้านๆ ก็ได้ครับ ที่พี่นิค ไห้มาผม พอเข้าใจ แต่ ผม ยังไม่เก่งขั้นนั้นครับบ รบกวนด้วยครับ
Hanakobz112
07-11-2014
15:48:18
คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา
โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ