<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0"> <thead style="background:#F4582D;color:#fff;"> <tr> <th><input type="checkbox" id="selectall" onClick="china_toggle(this)"><font color="#fff">Select All</font></th> <th><font color="#fff">Product</font></th> <th class="hidden-xs"><font color="#fff">Unit Cost</font></th> <th><font color="#fff">Sale Price</font></th> <th><font color="#fff">Total Pieces</font></th> <th><font color="#fff">Qty to Move</font></th> <th><font color="#fff">Cost Value</font></th> <th><font color="#fff">Sales Value</font></th> <th><font color="#fff">Profit Margin</font></th> </tr> </thead> <tfoot style="background:#F4582D;color:#fff;"> <tr> <th></th> <th><font color="#fff">Product</font></th> <th class="hidden-xs"><font color="#fff">Unit Cost</font></th> <th><font color="#fff">Sale Price</font></th> <th><font color="#fff">Total Pieces</font></th> <th><font color="#fff">Qty to Move</font></th> <th><font color="#fff">Cost Value</font></th> <th><font color="#fff">Sales Value</font></th> <th><font color="#fff">Profit Margin</font></th> </tr> </tfoot> <tbody> <?php if (isset($_GET['page_no']) && $_GET['page_no']!="") { $page_no = $_GET['page_no']; } else { $page_no = 1; } $total_records_per_page = 100; $offset = ($page_no-1) * $total_records_per_page; $previous_page = $page_no - 1; $next_page = $page_no + 1; $adjacents = "2"; $result_count = mysqli_query($con,"SELECT COUNT(*) As total_records FROM `low_stock_v`"); $total_records = mysqli_fetch_array($result_count); $total_records = $total_records['total_records']; $total_no_of_pages = ceil($total_records / $total_records_per_page); $second_last = $total_no_of_pages - 1; // total page minus 1 $sql=mysqli_query($con,"select * from low_stock_v LIMIT $offset, $total_records_per_page"); while($row=mysqli_fetch_array($sql)) { ?> <tr> <form method="post" action=""> <td><input type="checkbox" class="china[]" name="china[]" id="china[]" value="<?php echo $row['pro_id'] ?>" ></td> <td><input type="text" class="prod[]" name="prod[]" id="prod[]" value="<?php echo $row['pro_descrip'];?>" style="width:100%;border:none;" readonly="true" border="none" /></td> <td><?php echo $row['unit_cost'];?></td> <td><?php echo $row['sales_price'];?></td> <td><?php echo $row['totpcs'];?></td> <td><input type="text" class="qtyout[]" name="qtyout[]" id="qtyout[]" value="<?php echo isset($_POST['qtyout[]']) ? $_POST['qtyout[]'] : '' ?>" size="4" /></td> <td><?php echo $row['p_cost'];?></td> <td><?php echo $row['Sales_Value'];?></td> <td><?php echo $row['Profit_Margin'];?></td> <input type="hidden" class="proqty" name="proqty" id="proqty" value="0"/> </tr> <?php }?> </tbody> </table> <p align="center"><button type="submit" class="btn btn-success" name="save">Move Selected Row(s) to Store</button></p> </form>
if(isset($_POST['save'])){ for($i=0;$i<count($_POST['china']);$i++){ $chk = $_POST['china'][$i]; $prod_name = $_POST['prod'][$i]; $qty = $_POST['qtyout'][$i]; if($chk!=='' && $prod_name!=='' && $qty!==''){ mysqli_query($con,"insert into bulk_insert_t (pro_id,pro_descrip,qty)VALUES('$chk','$prod_name','$qty')"); //echo '<div class="alert alert-success" role="alert">Submitted Successfully</div>'; } else{ echo "<script type='text/javascript'>"; echo "alert('Error Submitting in Data')"; echo "</script>"; echo "<script>window.location.href ='product-list.php'</script>"; } } echo "<script type='text/javascript'>"; echo "alert('Submitted successfully')"; echo "</script>"; echo "<script>window.location.href ='product-list.php'</script>"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)