php - How to do multiple posts with one button -


i working following code(invoice.php), , posts inventory data "invoice" under table called "invoices". want add category called "salesman" under "invoices", , insert code coincide form post code in page. know how can insert both @ same time?

<?php      $user_obj = new cl_user();     if(!empty($_post)){         try {             $user_obj->saveinvoice($_post);             $_session['success'] = 'invoice saved successfully!';             header('location: invoices.php');exit;         } catch (exception $e) {             $error = $e->getmessage();         }     }elseif (isset($_get['uuid']) && !empty($_get['uuid'])){         try {             $results = $user_obj->getinvoice( $_get['uuid'] );         } catch (exception $e) {             $_session['error'] = $e->getmessage();         }     }elseif (isset($_get['delete']) && !empty($_get['delete'])){         try {             if( $user_obj->deleteinvoice( $_get['delete'] )){                 $_session['success'] = 'invoice deleted successfully!';                 header('location: invoices.php');exit;             }else{                 $_session['success'] = 'invoice not deleted, try again!';                 header('location: invoices.php');exit;             }          } catch (exception $e) {             $_session['error'] = $e->getmessage();         }     }      $settings = $user_obj->getsettings();     //echo "<pre>";print_r( $settings ); echo "</pre>";     $invoice = array();     if(!empty( $results )){         $invoice = json_decode( $results['invoice'], true);     } ?>       <!-- begin page content -->     <div class="container content-invoice">         <form action="<?php echo $_server['php_self']; ?>" id="invoice-form" method="post"  class="invoice-form" role="form" novalidate>              <div class="load-animate">                 <input type="hidden" value="<?php echo isset($results['id']) ? $results['id']: ''; ?>" name="data[id]">                 <div class='row'>                     <div class='col-xs-8 col-sm-8 col-md-8 col-lg-8'>                      </div>                      <div class='col-xs-4 col-sm-4 col-md-4 col-lg-4'>                         <input data-loading-text="saving workorder..." type="submit" name="invoice_btn" value="save workorder" class="btn btn-success submit_btn invoice-save-top form-control"/>                     </div>                 </div>                                      <th width="2%"><input id="check_all" class="formcontrol" type="checkbox"/></th>                                     <th width="15%">item no</th>                                     <th width="38%">item name</th>                                     <th width="15%">price</th>                                     <th width="15%">quantity</th>                                     <th width="15%">total</th>                                 </tr>                             </thead>                             <tbody>                                 <?php if(isset($invoice['data']['invoice'])&&!empty($invoice['data']['invoice'])){?>                                     <?php foreach ( $invoice['data']['invoice']['itemno'] $key=>$item){?>                                         <tr>                                             <td> <input class="case" type="checkbox"/> </td>                                             <td><input value="<?php echo isset($invoice['data']['invoice']['itemno'][$key]) ? $invoice['data']['invoice']['itemno'][$key]: ''; ?>" type="text" data-type="productcode" name="data[invoice][itemno][]" id="itemno_<?php echo $key+1?>" class="form-control autocomplete_txt" autocomplete="off"></td>                                             <td><input value="<?php echo isset($invoice['data']['invoice']['itemname'][$key]) ? $invoice['data']['invoice']['itemname'][$key]: ''; ?>" type="text" data-type="productname" name="data[invoice][itemname][]" id="itemname_<?php echo $key+1?>" class="form-control autocomplete_txt" autocomplete="off"></td>                                             <td><input value="<?php echo isset($invoice['data']['invoice']['price'][$key]) ? $invoice['data']['invoice']['price'][$key]: ''; ?>" type="number" name="data[invoice][price][]" id="price_<?php echo $key+1?>" class="form-control changesno" autocomplete="off" onkeypress="return isnumeric(event);" ondrop="return false;" onpaste="return false;"></td>                                             <td><input value="<?php echo isset($invoice['data']['invoice']['quantity'][$key]) ? $invoice['data']['invoice']['quantity'][$key]: ''; ?>" type="number" name="data[invoice][quantity][]" id="quantity_<?php echo $key+1?>" class="form-control changesno" autocomplete="off" onkeypress="return isnumeric(event);" ondrop="return false;" onpaste="return false;"></td>                                             <td><input value="<?php echo isset($invoice['data']['invoice']['total'][$key]) ? $invoice['data']['invoice']['total'][$key]: ''; ?>" type="number" name="data[invoice][total][]" id="total_<?php echo $key+1?>" class="form-control totallineprice" autocomplete="off" onkeypress="return isnumeric(event);" ondrop="return false;" onpaste="return false;"></td>                                         </tr>                                     <?php } ?>                                 <?php }else{?>                                     <tr>                                         <td><input class="case" type="checkbox"/></td>                                         <td><input type="text" data-type="productcode" name="data[invoice][itemno][]" id="itemno_1" class="form-control autocomplete_txt" autocomplete="off"></td>                                         <td><input type="text" data-type="productname" name="data[invoice][itemname][]" id="itemname_1" class="form-control autocomplete_txt" autocomplete="off"></td>                                         <td><input type="number" name="data[invoice][price][]" id="price_1" class="form-control changesno" autocomplete="off" onkeypress="return isnumeric(event);" ondrop="return false;" onpaste="return false;"></td>                                         <td><input type="number" name="data[invoice][quantity][]" id="quantity_1" class="form-control changesno" autocomplete="off" onkeypress="return isnumeric(event);" ondrop="return false;" onpaste="return false;"></td>                                         <td><input type="number" name="data[invoice][total][]" id="total_1" class="form-control totallineprice" autocomplete="off" onkeypress="return isnumeric(event);" ondrop="return false;" onpaste="return false;"></td>                                     </tr>                                 <?php } ?>                             </tbody>                         </table>                     </div>                 </div>                           <div class='form-group text-center'>                             <input data-loading-text="saving invoice..." type="submit" name="invoice_btn" value="save workorder" class="btn btn-success submit_btn invoice-save-btm"/>                         </div>                      </div>          </form>              </div>     <script src="js/jquery-ui.min.js"></script>     <script src="js/auto.js"></script>     <script>         $('.submit_btn').on('click', function(){             $(this).button('loading');         });          $(document).ready(function(){             $('.currency').html( $('#currency').val() );         });          $('#clientcompanyname').autocomplete({             source: function( request, response ) {                 $.ajax({                     url : 'ajax.php',                     datatype: "json",                     method: 'post',                     data: {                         name_startswith: request.term,                         type: 'customername'                     },                     success: function( data ) {                         response( $.map( data, function( item ) {                             var code = item.split("|");                                 return {                                     label: code[1],                                     value: code[1],                                     data : item                                 }                             }));                         }                     });             },             autofocus: true,                         minlength: 1,             select: function( event, ui ) {                 var names = ui.item.data.split("|");                 $(this).val(names[1]);                 getclientaddress(names[0]);             }                        });         function getclientaddress(id){               $.ajax({                  url: "ajax.php",                  method: 'post',                   data:{id:id, type:'clientaddress'},                  success: function(result){                     $("#clientaddress").html(result);                 }             });         }          </script>       <?php ob_end_flush(); ?>      <?php       unset($_session['success'] );      unset($_session['error']);      ?>        <script src="js/bootstrap.min.js"></script>     <script src="js/bootstrap-datepicker.js"></script>   </body> </html> 


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -