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,027

HOME > PHP > PHP Forum > jquery radio button แสดงแค่แถวแรกแถวเดียว...ใส่ loop แล้วน้ะ...เเต่ยังขึ้นแค่แถวแรกค่ะ



 

jquery radio button แสดงแค่แถวแรกแถวเดียว...ใส่ loop แล้วน้ะ...เเต่ยังขึ้นแค่แถวแรกค่ะ

 



Topic : 102257



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



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



jquery radio button แสดงแค่แถวแรกแถวเดียว......................................... ใส่ loop แล้วน้ะ...เเต่ยังขึ้นแค่แถวแรกค่ะ

Capture

Code (PHP)
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />
  <script>
  $(function() {
    $( "#radio" ).buttonset();
  });
  $(function() {
    $( "#radio1" ).buttonset();
  });
  </script>


	
</head> 
<body> 
<form action="save_chkmotor.php?mID=<?=$_GET["mID"];?>" method="post"  data-ajax="false" >
       <table width="100%" style="font-family: helvetica; font-size:12px; text-shadow:none;" cellspacing="0">
        <tr align="center" bgcolor="#989898" >
           <th width="3%" height="37">#</th>
           <th width="47%">รายการ</th>
           <th width="25%">ตามใบตรวจสภาพ</th>
           <th width="25%">ตามที่ตรวจจริง</th>
           <!--<th width="77">รายการผิดพลาด</th>-->
        </tr>
		<?
		   $strSQL    = "SELECT * FROM spare_store
                         WHERE			 
                         brand_id   = '".$_GET["bID"]."'  AND
                         class_id   = '".$_GET["cID"]."'  
                         ORDER BY idno ASC";
            $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
			$count    = mysql_num_rows($objQuery);
			$x=0;
            while($objResult = mysql_fetch_array($objQuery))
            {
				$sp_code   = $objResult["sp_code"];
				$sp_name   = $objResult["sp_name"];
				$price     = $objResult["price"];
				$brand     = $objResult["brand_id"];
				$class     = $objResult["class_id"];
				$x++;
				if($x%2==0)
				{
				$bg = "#CCCCCC";
				}
				else
				{
				$bg = "#FFFFFF";
				}
				?>
		<tr bgcolor="<?=$bg;?>">        	
            <td><b><?=$x;?>.</b></td>
            <td align="left"><?=$sp_name?></td>
            <input name="strno" type="hidden" value="<?=$_GET["mID"];?>" />
            <input name="brand" type="hidden" value="<?=$brand;?>" />
            <input name="class" type="hidden" value="<?=$class;?>" />
            <input name="sp_code[<?=$x;?>]" type="hidden" value="<?=$sp_code;?>" />
            <input name="sp_name[<?=$x;?>]" type="hidden" value="<?=$sp_name;?>" />
            <input name="price[<?=$x;?>]"   type="hidden" value="<?=$price;?>" />
            <td align="center">
              <div id="radio">
                <input type="radio" name="bill[<?=$x;?>]" id="bill<?=$x;?>_1" /><label for="bill<?=$x;?>_1">ใช้ได้</label>
                <input type="radio" name="bill[<?=$x;?>]" id="bill<?=$x;?>_2" /><label for="bill<?=$x;?>_2">ชำรุด</label>
                <input type="radio" name="bill[<?=$x;?>]" id="bill<?=$x;?>_3" /><label for="bill<?=$x;?>_3">ไม่มี</label>
              </div>
           </td>
           <td align="center">
              <div id="radio1">
                <input type="radio" name="jing[<?=$x;?>]" id="jing<?=$x;?>_1" /><label for="jing<?=$x;?>_1">ใช้ได้</label>
                <input type="radio" name="jing[<?=$x;?>]" id="jing<?=$x;?>_2" /><label for="jing<?=$x;?>_2">ชำรุด</label>
                <input type="radio" name="jing[<?=$x;?>]" id="jing<?=$x;?>_3" /><label for="jing<?=$x;?>_3">ไม่มี</label>
              </div>
           </td>
        </tr>
        <? } ?>
        <tr>
        	<td colspan="5">
            	<input type="hidden" name="count" value="<?=$x;?>" />
            	<input type="submit" id="submit" value="บันทึกข้อมูล"  data-role="button" data-inline="true" data-theme="b" data-mini="true"/>
            </td>
        </tr>
        </table>
</form>
</body>





Tag : PHP, MySQL, jQuery









ประวัติการแก้ไข
2013-11-01 11:26:10
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-11-01 11:25:24 By : PALM26 View : 880 Reply : 3
 

 

No. 1



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

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

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

buttonset() มันทำงานเป็น group ครับ ในที่นี้ผมจับใส่ div 2 ตัว
รันตัวนี้ แล้วดู code ครับ น่าจะช่วยให้เข้าใจมากขึ้น
อ่อ อีกอย่าง เรื่อง label ใส่ for ตาม id ของ radio น่ะครับ
Code (PHP)
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Multiple button group</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(function() {
	$( '#group1').buttonset();
	$( '#group2').buttonset();
});


</script>
</head>
<body>
<form>
<div id="group1">
<input type="radio" id="radio11" name="radio#1" /><label for="radio11">Choice 1</label>
<input type="radio" id="radio12" name="radio#1" checked="checked" /><label for="radio12">Choice 2</label>
<input type="radio" id="radio13" name="radio#1" /><label for="radio13">Choice 3</label>
</div>
<br /><br />
<div id="group2">
<input type="radio" id="radio21" name="radio#2" /><label for="radio21">Choice 1</label>
<input type="radio" id="radio22" name="radio#2" /><label for="radio22">Choice 2</label>
<input type="radio" id="radio23" name="radio#2" checked="checked" /><label for="radio23">Choice 3</label>
</div>
</form>
</body>
</html>


uu






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-11-01 11:47:15 By : mangkunzo
 


 

No. 2



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



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

ยังเหมือนเดิมค่ะ....

Code (PHP)
<? include "connect.php";?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(function() {
	$( '#group1').buttonset();
	$( '#group2').buttonset();
});


</script>


</head> 
<body> 
<form action="save_chkmotor.php?mID=<?=$_GET["mID"];?>" method="post"  data-ajax="false" >
       <table width="100%" style="font-family: Verdana, Geneva, sans-serif; font-size:12px; text-shadow:none;" cellspacing="0">
        <tr align="center" bgcolor="#989898" >
           <th width="3%" height="37">#</th>
           <th width="47%">รายการ</th>
           <th width="25%">ตามใบตรวจสภาพ</th>
           <th width="25%">ตามที่ตรวจจริง</th>
           <!--<th width="77">รายการผิดพลาด</th>-->
        </tr>
		<?
		   $strSQL    = "SELECT * FROM spare_store
                         WHERE			 
                         brand_id   = '".$_GET["bID"]."'  AND
                         class_id   = '".$_GET["cID"]."'  
                         ORDER BY idno ASC";
            $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
			$count    = mysql_num_rows($objQuery);
			$x=0;
            while($objResult = mysql_fetch_array($objQuery))
            {
				$sp_code   = $objResult["sp_code"];
				$sp_name   = $objResult["sp_name"];
				$price     = $objResult["price"];
				$brand     = $objResult["brand_id"];
				$class     = $objResult["class_id"];
				$x++;
				if($x%2==0)
				{
				$bg = "#CCCCCC";
				}
				else
				{
				$bg = "#FFFFFF";
				}
				?>
		<tr bgcolor="<?=$bg;?>">        	
            <td><b><?=$x;?>.</b></td>
            <td align="left"><?=$sp_name?></td>
            <input name="strno" type="hidden" value="<?=$_GET["mID"];?>" />
            <input name="brand" type="hidden" value="<?=$brand;?>" />
            <input name="class" type="hidden" value="<?=$class;?>" />
            <input name="sp_code[<?=$x;?>]" type="hidden" value="<?=$sp_code;?>" />
            <input name="sp_name[<?=$x;?>]" type="hidden" value="<?=$sp_name;?>" />
            <input name="price[<?=$x;?>]"   type="hidden" value="<?=$price;?>" />
            <td align="center">
                <div id="group1">
                <input type="radio"  name="jing[<?=$x;?>]" id="jing<?=$x;?>_1" /><label for="jing<?=$x;?>_1">ใช้ได้</label>
                <input type="radio"  name="jing[<?=$x;?>]" id="jing<?=$x;?>_2" /><label for="jing<?=$x;?>_2">ชำรุด</label>
                <input type="radio"  name="jing[<?=$x;?>]" id="jing<?=$x;?>_3" /><label for="jing<?=$x;?>_3">ผิดพลาด</label>
                </div>
           </td>
           <td align="center">
                <div id="group2">
                <input type="radio"  name="bill[<?=$x;?>]" id="bill<?=$x;?>_1" /><label for="bill<?=$x;?>_1">ใช้ได้</label>
                <input type="radio"  name="bill[<?=$x;?>]" id="bill<?=$x;?>_2" /><label for="bill<?=$x;?>_2">ชำรุด</label>
                <input type="radio"  name="bill[<?=$x;?>]" id="bill<?=$x;?>_3" /><label for="bill<?=$x;?>_3">ผิดพลาด</label>
                </div>
           </td>
        </tr>
        <? } ?>
        <tr>
        	<td colspan="5">
            	<input type="hidden" name="count" value="<?=$x;?>" />
            	<input type="submit" id="submit" value="บันทึกข้อมูล"  data-role="button" data-inline="true" data-theme="b" data-mini="true"/>
            </td>
        </tr>
        </table>
</form>
</body>



ประวัติการแก้ไข
2013-11-01 11:57:06
2013-11-01 11:57:49
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-11-01 11:56:26 By : PALM26
 

 

No. 3



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

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

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

ตอบความคิดเห็นที่ : 2 เขียนโดย : PALM26 เมื่อวันที่ 2013-11-01 11:56:26
รายละเอียดของการตอบ ::
เปลี่ยนจาก
Code (PHP)
<script>
$(function() {
	$( '#group1').buttonset();
	$( '#group2').buttonset();
});


</script>


เป็นแบบนี้ครับ
Code (PHP)
<script>
$(function() {
	$('div').each(function(){
		var id =  $(this).attr('id');
		$('#'+id).buttonset();
	});	
});
</script>


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-11-01 13:48:24 By : mangkunzo
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : jquery radio button แสดงแค่แถวแรกแถวเดียว...ใส่ loop แล้วน้ะ...เเต่ยังขึ้นแค่แถวแรกค่ะ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 05
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 อัตราราคา คลิกที่นี่