<table class="noborder auto"> <tbody> <?php while($row_sauce = $result_sauce->fetch_assoc()){ ?> <tr> <td style="text-align:left;"> <label style="font-family: inherit;"> <input type="checkbox" name="sauce[]" id="sauce" class="required" value="<?php echo $row_sauce['pro_id']; ?>"/><?php echo $row_sauce['pro_name']; ?></label> </td> <td> <input style="height:inherit;line-height:inherit;" type="number" class="required" for="sauce[]" name="sauce_qty[]" id="sauce_qty"></input> </td> </tr> <?php } ?> </tbody> </table>
$count_sauce = count($_POST['sauce']); for($s=0;$s < $count_sauce;$s++){ $sql9 = "select * from product_branch where pro_id = '".$_POST['sauce'][$s]."' and branch_id = '".$_SESSION['cus_branch']."'"; $result9 = $conn->query($sql9); if($count9 = $result9->num_rows){ $row9 = $result9->fetch_assoc(); $sauce = $row9['pro_sale'] + $_POST['sauce_qty'][$s]; $sql10 = "update product_branch set pro_sale = '".$sauce."' where probranch_id = '".$row9['probranch_id']."'"; if($result10 = $conn->query($sql10)){ $sql11 = "insert into orders_sauce (order_id,product_id,product_qty) values ('".$order_id."','".$_POST['sauce'][$s]."','".$_POST['sauce_qty'][$s]."')"; $result11 = $conn->query($sql11); } } }
<table class="noborder auto"> <tbody> <?php while($row_sauce = $result_sauce->fetch_assoc()){ ?> <tr> <td style="text-align:left;"> <label style="font-family: inherit;"> <input type="checkbox" rel="sauce_qty[<?php echo $row_sauce['pro_id']; ?>]" name="sauce[<?php echo $row_sauce['pro_id']; ?>]" id="sauce" class="required" value="<?php echo $row_sauce['pro_id']; ?>"></input><?php echo $row_sauce['pro_name']; ?></label> </td> <td> <input style="height:inherit;line-height:inherit;" type="number" onfocus="this.select();" onmouseup="return false;" class="required" name="sauce_qty[<?php echo $row_sauce['pro_id']; ?>]" id="sauce_qty" value="0"></input> </td> </tr> <script> $(document).ready(function(){ $('#sauce_qty').prop("disabled",true); $('#sauce').change(function(){ var rel = $(this).attr('rel'); if($(this).is(":checked")) $("#sauce_qty[name='"+rel+"']").prop("disabled", false).focus(); else $("#sauce_qty[name='"+rel+"']").prop("disabled", true); }); }); </script> <?php } ?> </tbody> </table>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง