Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,030

HOME > PHP > PHP Forum > สอบถามหน่อยครับ ต้องการให้เมื่อเลือก radio button 1,2,3 .. แล้วไปแสดงผลเท่ากับ radio button รวม(มีรูป)



 

สอบถามหน่อยครับ ต้องการให้เมื่อเลือก radio button 1,2,3 .. แล้วไปแสดงผลเท่ากับ radio button รวม(มีรูป)

 



Topic : 124943



โพสกระทู้ ( 211 )
บทความ ( 0 )



สถานะออฟไลน์




สอบถามหน่อยครับ ต้องการให้เมื่อเลือก radio button 1,2,3 .. แล้วไปแสดงผลเท่ากับ radio button รวม(มีรูป)

คือ เมื่อเลือกอันข้างบนหลายๆอัน ถ้าเกิดเลือกไม่ผ่านสักอันเดียว ผล radio button ล่างสุดก็จะไม่ผ่าน

s

Code (PHP)
<form id="formRegister" name="formRegister" method="post" action="save_check_restuarane_bct.php">
  <table width="1073" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
    <tr>
      <td height="40" colspan="2" align="center" bgcolor="#D6D5D6"><b>บันทึกการตรวจร้าน</b></td>
    </tr>
    <tr>
      <td colspan="2" align="right" bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
            <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;9. ช้อน ส้อม ตะเกียบ  วางตั้งเอาด้ามขึ้นในภาชนะโปร่งสะ อาด และมีการปกปิด เก็บสูงจากพื้นอย่างน้อย 60  ซม.</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="SPOON" value="0" id="SPOON0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="SPOON" value="1" id="SPOON1" />
          ไม่ผ่าน</label>
      <label for="SPOON"></label></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left"></div></td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;10. มูลฝอย และน้ำเสียทุกชนิด  ได้รับการกำจัดด้วยวิธีที่ถูกหลักสุขาภิบาล</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="GARBAGE" value="0" id="GARBAGE0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="GARBAGE" value="1" id="GARBAGE1" />
          ไม่ผ่าน</label>
      <label for="GARBAGE"></label></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left"></div></td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;11. ห้องส้วมสำหรับผู้บริโภคและผู้สัมผัสอาหารต้องสะอาด  มีอ่างล้างมือที่ใช้การได้ดี และมีสบู่ใช้ตลอดเวลา</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="TOILET" value="0" id="TOILET0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="TOILET" value="1" id="TOILET1" />
          ไม่ผ่าน</label>
      <label for="TOILET"></label></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left"></div></td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;12. ผู้สัมผัสอาหารแต่งกายสะอาด  สวมเสื้อมีแขน ผู้ปรุงต้องผูกผ้ากันเปื้อนที่สะอาด สวมหมวกหรือเน็ทคลุมผม</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="COOK_CLOTH" value="0" id="COOK_CLOTH0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="COOK_CLOTH" value="1" id="COOK_CLOTH1" />
          ไม่ผ่าน</label>
      <label for="COOK_CLOTH"></label></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left"></div></td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;13. ผู้สัมผัสอาหารต้องล้างมือให้สะอาดก่อนเตรียมปรุง  ประกอบ จำหน่ายอาหารทุกครั้ง ใช้อุปกรณ์ในการหยิบจับอาหารที่ปรุงแล้วทุกชนิด</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="COOK_CLEAN" value="0" id="COOK_CLEAN0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="COOK_CLEAN" value="1" id="COOK_CLEAN1" />
          ไม่ผ่าน</label>
      <label for="COOK_CLEAN"></label></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left"></div></td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;14. ผู้สัมผัสอาหารที่มีบาดแผลที่มือต้องปิดแผลให้มิดชิด  หลีกเลี่ยงการปฏิบัติงานที่มีโอกาสสัมผัสอาหาร</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="COOK_SAVE" value="0" id="COOK_SAVE0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="COOK_SAVE" value="1" id="COOK_SAVE1" />
          ไม่ผ่าน</label>
      <label for="COOK_SAVE"></label></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left"></div></td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;15. ผู้สัมผัสอาหารที่เจ็บป่วยด้วยโรคที่สามารถติดต่อไปยังผู้บริโภค  โดยมีน้ำและอาหารเป็นสื่อ ให้หยุดปฏิบัติงานจนกว่าจะรักษาให้หายขาด</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="COOK_DISEASES" value="0" id="COOK_DISEASES0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="COOK_DISEASES" value="1" id="COOK_DISEASES1" />
          ไม่ผ่าน</label>
      <label for="COOK_DISEASES"></label></td>
    </tr>
    <tr>
      <td colspan="2" bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" bgcolor="#EBEBEB">&nbsp;&nbsp;&nbsp;&nbsp;ผล :        
        <label>
          <input type="radio" name="RESULT" value="0" id="RESULT0" />
          ผ่าน</label>
        <label>
          <input type="radio" name="RESULT" value="1" id="RESULT1" />
      ไม่ผ่าน</label></td>
    </tr>
    <tr>
      <td colspan="2" bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
         <tr>
      <td colspan="2" bgcolor="#EBEBEB"> &nbsp;
        &nbsp; <div align="center">
          <input type="reset" name="Reset" id="button" value="ล้างข้อมูล" style="width:80px;height:50px"/>        
           <input type="submit" name="Register" id="Register" value="บันทึก" style="width:80px;height:50px"/>
      </div></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB">&nbsp;</td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
  </table>
  <p><br />
    <br />
  </p>
</form>




Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2016-10-13 13:22:49 By : sweerawat View : 729 Reply : 6
 

 

No. 1



โพสกระทู้ ( 5,105 )
บทความ ( 4 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


validate input radio option มีมากมายหลายวิธี






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2016-10-13 15:23:57 By : apisitp
 


 

No. 2



โพสกระทู้ ( 3,155 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


"ผ่าน" กำหนด =1 / "ไม่ผ่าน" กำหนด = 0 และ เติม <tbody></tbody> , <tfoot></tfoot> เพื่อกำหนดขอบเขต
<form id="formRegister" name="formRegister" method="post" action="save_check_restuarane_bct.php">
  <table width="1073" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
    <tr>
      <td height="40" colspan="2" align="center" bgcolor="#D6D5D6"><b>บันทึกการตรวจร้าน</b></td>
    </tr>
    <tr>
      <td colspan="2" align="right" bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tbody>
    <tr>
            <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;9. ช้อน ส้อม ตะเกียบ  วางตั้งเอาด้ามขึ้นในภาชนะโปร่งสะ อาด และมีการปกปิด เก็บสูงจากพื้นอย่างน้อย 60  ซม.</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="SPOON" value="1" id="SPOON0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="SPOON" value="0" id="SPOON1" />
          ไม่ผ่าน</label>
      <label for="SPOON"></label></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left"></div></td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;10. มูลฝอย และน้ำเสียทุกชนิด  ได้รับการกำจัดด้วยวิธีที่ถูกหลักสุขาภิบาล</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="GARBAGE" value="1" id="GARBAGE0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="GARBAGE" value="0" id="GARBAGE1" />
          ไม่ผ่าน</label>
      <label for="GARBAGE"></label></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left"></div></td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;11. ห้องส้วมสำหรับผู้บริโภคและผู้สัมผัสอาหารต้องสะอาด  มีอ่างล้างมือที่ใช้การได้ดี และมีสบู่ใช้ตลอดเวลา</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="TOILET" value="1" id="TOILET0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="TOILET" value="0" id="TOILET1" />
          ไม่ผ่าน</label>
      <label for="TOILET"></label></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left"></div></td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;12. ผู้สัมผัสอาหารแต่งกายสะอาด  สวมเสื้อมีแขน ผู้ปรุงต้องผูกผ้ากันเปื้อนที่สะอาด สวมหมวกหรือเน็ทคลุมผม</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="COOK_CLOTH" value="1" id="COOK_CLOTH0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="COOK_CLOTH" value="0" id="COOK_CLOTH1" />
          ไม่ผ่าน</label>
      <label for="COOK_CLOTH"></label></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left"></div></td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;13. ผู้สัมผัสอาหารต้องล้างมือให้สะอาดก่อนเตรียมปรุง  ประกอบ จำหน่ายอาหารทุกครั้ง ใช้อุปกรณ์ในการหยิบจับอาหารที่ปรุงแล้วทุกชนิด</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="COOK_CLEAN" value="1" id="COOK_CLEAN0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="COOK_CLEAN" value="0" id="COOK_CLEAN1" />
          ไม่ผ่าน</label>
      <label for="COOK_CLEAN"></label></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left"></div></td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;14. ผู้สัมผัสอาหารที่มีบาดแผลที่มือต้องปิดแผลให้มิดชิด  หลีกเลี่ยงการปฏิบัติงานที่มีโอกาสสัมผัสอาหาร</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="COOK_SAVE" value="1" id="COOK_SAVE0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="COOK_SAVE" value="0" id="COOK_SAVE1" />
          ไม่ผ่าน</label>
      <label for="COOK_SAVE"></label></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left"></div></td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB"><div align="left">&nbsp;&nbsp;&nbsp;15. ผู้สัมผัสอาหารที่เจ็บป่วยด้วยโรคที่สามารถติดต่อไปยังผู้บริโภค  โดยมีน้ำและอาหารเป็นสื่อ ให้หยุดปฏิบัติงานจนกว่าจะรักษาให้หายขาด</div></td>
      <td bgcolor="#EBEBEB"><label>
        <input type="radio" name="COOK_DISEASES" value="1" id="COOK_DISEASES0" />
        ผ่าน</label>
        <label>
          <input type="radio" name="COOK_DISEASES" value="0" id="COOK_DISEASES1" />
          ไม่ผ่าน</label>
      <label for="COOK_DISEASES"></label></td>
    </tr>
    <tr>
      <td colspan="2" bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    </tbody>
    <tfoot>
    <tr>
      <td colspan="2" bgcolor="#EBEBEB">&nbsp;&nbsp;&nbsp;&nbsp;ผล :        
        <label>
          <input type="radio" name="RESULT" value="1" id="RESULT0" />
          ผ่าน</label>
        <label>
          <input type="radio" name="RESULT" value="0" id="RESULT1" />
      ไม่ผ่าน</label></td>
    </tr>
    <tr>
      <td colspan="2" bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    <tr>
         <tr>
      <td colspan="2" bgcolor="#EBEBEB"> &nbsp;
        &nbsp; <div align="center">
          <input type="reset" name="Reset" id="button" value="ล้างข้อมูล" style="width:80px;height:50px"/>        
           <input type="submit" name="Register" id="Register" value="บันทึก" style="width:80px;height:50px"/>
      </div></td>
    </tr>
    <tr>
      <td bgcolor="#EBEBEB">&nbsp;</td>
      <td bgcolor="#EBEBEB">&nbsp;</td>
    </tr>
    </tfoot>
  </table>
  <p><br />
    <br />
  </p>
</form>



Code (JavaScript)
$(document).ready(function(){  
  var radios = $("tbody input:radio");
  var questscount = parseInt(radios.length/2);
  var pass = 1 , answerscount = 0;
    
  radios.click(function(){
  	var current = $(this),
	currentChecked = current.parents('tbody').find('input:radio:checked'),
  	answerscount = currentChecked.length;   
	pass = 1;
	currentChecked.each(function(){    	
    		pass = pass&&parseInt($(this).val());
	});    
    
    if(answerscount == questscount){
     	if(pass)
    		$("#RESULT0").prop("checked",true);
    	else
      		$("#RESULT1").prop("checked",true);
    }

  })
});


https://jsfiddle.net/umc5x6cg/


ประวัติการแก้ไข
2016-10-17 10:05:11
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2016-10-17 10:03:27 By : sakuraei
 

 

No. 3



โพสกระทู้ ( 211 )
บทความ ( 0 )



สถานะออฟไลน์


ขอบคุณมากๆครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2016-10-17 11:55:20 By : sweerawat
 


 

No. 4



โพสกระทู้ ( 211 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 2 เขียนโดย : sakuraei เมื่อวันที่ 2016-10-17 10:03:27
รายละเอียดของการตอบ ::
..... รบกวนอธิบาย สคริป ข้างล่างหน่อยได้มั้ยครับ พอดีผมให้ผ่าน = 0 ไม่ผ่าน = 1
เลือกครั้งแรกมันได้แต่พอเปลี่ยนกลับ ผลกลับไม่เปลี่ยนเป็นผ่านน่ะครับ ขอบคุณมากครับ


Code (PHP)
$(document).ready(function(){  
  var radios = $("tbody input:radio");
  var questscount = parseInt(radios.length/2);
  var pass = 1 , answerscount = 0;
    
  radios.click(function(){
  	var current = $(this),
	currentChecked = current.parents('tbody').find('input:radio:checked'),
  	answerscount = currentChecked.length;   
	pass = 1;
	currentChecked.each(function(){    	
    		pass = pass&&parseInt($(this).val());
	});    
    
    if(answerscount == questscount){
     	if(pass)
    		$("#RESULT0").prop("checked",true);
    	else
      		$("#RESULT1").prop("checked",true);
    }

  })
});

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2016-10-18 10:52:19 By : sweerawat
 


 

No. 5



โพสกระทู้ ( 211 )
บทความ ( 0 )



สถานะออฟไลน์


พอคลิ๊กอะไร ผลมันก็กลายเป็นไม่ผ่านหมดเลยครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2016-10-18 10:55:29 By : sweerawat
 


 

No. 6



โพสกระทู้ ( 3,155 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


ตอบความคิดเห็นที่ : 5 เขียนโดย : sweerawat เมื่อวันที่ 2016-10-18 10:55:29
รายละเอียดของการตอบ ::
ลองสลับดูครับ

Code (JavaScript)
if(pass)
$("#RESULT1").prop("checked",true);
else
$("#RESULT0").prop("checked",true);
}


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2016-10-18 11:14:38 By : sakuraei
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สอบถามหน่อยครับ ต้องการให้เมื่อเลือก radio button 1,2,3 .. แล้วไปแสดงผลเท่ากับ radio button รวม(มีรูป)
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่