|  |  | 
          
            |  
 ข้อมูลแบบ TAB ทำอย่างไรให้จำค่าข้อมูลที่เลือกใน TAB นั้นๆ  ถ้าเราคลิ้กไป TAB อื่น
 
 Code (PHP)
 
 <? include "connect.php";?>
<body> 
<?
		   $strSQL    = "SELECT strno,sp_code,sp_name,brand_id,class_id,price FROM estimate
                         WHERE			 
                         brand_id   = '$brand_id'  AND
                         class_id   = '$class_id'  						 
						 GROUP BY sp_code 
						 ";
            $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
			$count    = mysql_num_rows($objQuery);
?>
<div id="right_block6">
<div id="tabContaier">
	<ul>
    	<li><a href="estimate01.php?sID=<?=$strno;?>&brand=<?=$brand_id;?>&class=<?=$class_id;?>" class="active" >อะไหล่ใช้บ่อย</a></li>
    	<li><a href="estimate02.php?sID=<?=$strno;?>&brand=<?=$brand_id;?>&class=<?=$class_id;?>">ไฟ</a></li>
    	<li><a href="estimate03.php?sID=<?=$strno;?>&brand=<?=$brand_id;?>&class=<?=$class_id;?>">เครื่องยนต์</a></li>
    	<li><a href="estimate04.php?sID=<?=$strno;?>&brand=<?=$brand_id;?>&class=<?=$class_id;?>">ไฟเบอร์</a></li>
    	<li><a href="estimate05.php?sID=<?=$strno;?>&brand=<?=$brand_id;?>&class=<?=$class_id;?>">อื่นๆ</a></li>
    </ul><!-- //Tab buttons -->
</div> <br /><br /><br>
<form action="save_estimate.php?sID=<?=$_GET["sID"];?>" method="post" name="form1" >
       <table width="100%" style="font-family: Verdana, Geneva, sans-serif; font-size:12px;" cellspacing="0">
        <tr align="center" bgcolor="#989898" >
           <td width="2%" height="37"><b>#</b></td>
            <td width="16%" align="left"><b>รหัสอะไหล่</b></td>
           <td width="38%" align="left"><b>รายการอะไหล่</b></td>
           <td width="18%" align="left"><b>เบิก/ทำสี</b></td>
           <td width="16%" align="left"><b>ราคา</b></td>
           <td width="13%" align="left"><b>จำนวน</b></td>
           <td width="13%" align="left"><b>ราคารวม</b></td>
        </tr>
		<?
			$x=0;
            while($objResult = mysql_fetch_array($objQuery))
            {
				$group_no  = $objResult["group_no"];
				$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 = "#e7e7fe";
				}
				else
				{
				$bg = "#FFFFFF";
				}
				?>
		<tr bgcolor="<?=$bg;?>">        	
            <td height="39"><?=$x;?>.<input type="hidden" name="idno[<?=$x-1;?>]" id="idno[<?=$x-1;?>]" value="<?=$x;?>"></td>
            <td align="left"><?=$sp_code?></td>
            <td align="left"><?=$sp_name?></td>
              <input name="sp_name[<?=$x;?>]" type="hidden" value="<?=$sp_name;?>" />
              <input name="sp_code[<?=$x;?>]" type="hidden" value="<?=$sp_code;?>" />
              <input name="price[<?=$x;?>]"   type="hidden" value="<?=$price;?>" />
              <input name="group_no" type="hidden" value="<?=$group_no;?>" />
              <input name="brand"    type="hidden" value="<?=$brand;?>" />
              <input name="class"    type="hidden" value="<?=$class;?>" />
              <input name="strno"    type="hidden" value="<?=$_GET["sID"];?>" />
            <td align="left">
            <div id="radio-demo">    
              <input type="checkbox"  name="chk_take[<?=$x;?>]" id="chk_take<?=$x;?>_1" value="1" 
              onClick="javaScript:if(this.checked)
              			{
                        document.form1.total<?=$x;?>.disabled=false;
                        document.form1.price<?=$x;?>.disabled=false;
                        document.form1.take<?=$x;?>.disabled=false;
                        }" >
              <label for="chk_take<?=$x;?>_1">เบิก</label>
              <input type="checkbox"  name="chk_take[<?=$x;?>]" id="chk_take<?=$x;?>_2" value="2" 
              onClick="javaScript:if(this.checked)
              			{ 
                        document.form1.total<?=$x;?>.disabled=true;
                        document.form1.price<?=$x;?>.disabled=true;
                        document.form1.take<?=$x;?>.disabled=true;
                        }">
              <label for="chk_take<?=$x;?>_2">ทำสี</label>
            </div>
           </td>
           <td><input type="text" name="price<?=$x;?>" value="<?=number_format($price, 2, '.', ', ');?>" size="8" disabled readonly></td>
           <td>
              <input type="text" name="take[<?=$x;?>]" id="take<?=$x;?>" autocomplete="off" 
               onKeyDown="var textStatus  = document.getElementById('take<?=$x;?>'); 
                          var checkStatus = document.getElementById('chk_take<?=$x;?>_1'); 
                          if(textStatus.value!='') checkStatus.checked='checked'; 
                          else if(textStatus.value =='') checkStatus.checked=''
               			  if(this.value==0) this.value = '';"  
               onKeyUp="if(this.value==0) this.value=0;
               			document.all.total<?=$x;?>.value = (parseFloat(document.all.take<?=$x;?>.value)* <?=$price;?>) .toFixed(2);
                        if(document.getElementById('sum').value == '')
                           document.getElementById('sum').value = 0;
                           document.getElementById('sum').value = parseFloat(document.getElementById('sum').value)+parseFloat(document.all.total<?=$x;?>.value);" 
                           value="0"size="8">      
           </td>
           <td><input type="text" name="total<?=$x;?>" id="total<?=$x;?>" value="0" readonly size="8"></td>
        </tr>
        <? } ?>
        <tr bgcolor="#f0e79b">
        	<td height="33" colspan="6" align="center"><b>ราคารวม (บาท)</b></td>
          <td><input type="text" name="sum" id="sum" readonly size="8"></td>
        </tr>
        <tr>
        	<td colspan="5">
            	<input type="hidden" name="count" value="<?=$x;?>" />
            	<input type="submit" id="submit" value="บันทึกข้อมูล" style="width:75px; height:30px;"/>
            </td>
        </tr>
        </table>
</form>
</div>
</body>
 
 
 Tag : PHP, MySQL
 
 
 |  
            | 
 ประวัติการแก้ไข
 2013-11-09 12:34:13
 |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2013-11-09 12:33:24 | By :
                          PALM26 | View :
                          690 | Reply :
                          1 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |