Jump to content

sanem

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by sanem

  1. is not a solution plz try this code and tell me whats wrong this code
  2. data store in db as same as table using party_id view :- <form action="<?php echo base_url(); ?>daily_orders/do_add" id="frmvalidate" method="post" role="form" enctype="multipart/form-data"> <div class="box-header"> <div class="row"> <div class="col-lg-2"> <input type="date" name="order_date" class="form-control" value="<?php echo date('Y-m-d'); ?>"> </div> </div> </div> <div class="box-body table-responsive"> <table class="table table-bordered table-condensed table-hover table-striped" id="dtHorizontalExample" width="1200px;"> <thead> <tr> <th style="color: #d81b60;"> Party Name \ Product Name</th> <?php foreach ($products as $key => $value) {?> <th> <input type="text" name="product_name[]" class="form-control" value="<?php echo $value['product_name'].' - '.$value['quantity'].' '.$value['unit_measurmrnt']; ?>" readonly> </th> <?php } ?> </tr> </thead> <tbody> <tr> <?php foreach ($party_master as $key => $value) {?> <tr> <th> <input type="text" name="party_name[]" class="form-control" value="<?php echo $value['party_name']; ?>" readonly> <input type="hidden" name="party_id[]" value="<?php echo $value['id']; ?>"> <?php foreach ($products as $key => $value1) { ?> <th><input type="text" name="quantity_<?php echo $value['id'] ?>_<?php echo $value1['id'] ?>" class="form-control" placeholder="quantity"></th> <input type="hidden" name="product_name_<?php echo $value['id'] ?>_<?php echo $value1['id'] ?>" value="<?php echo $value1['id']; ?>"> <?php } ?> </tr> <?php } ?> </tr> </tbody> </table> <div class="box-footer"> <button type="submit" class="btn bg-maroon btn-flat pull-right">Submit</button> </div> </div> </form> controller :- function do_add() { $cng=count($_POST['party_id']); for ($i=0; $i < $cng; $i++) { $cng1=count($_POST['product_name_'.$_POST['party_id'][$i]]); for ($m=0; $m < $cng1; $m++) { $insert_arr = array( 'party_id'=>$_POST['party_id'][$i], 'order_date'=>$_POST['order_date'], 'party_name'=>'', 'product_name'=>'', 'quantity'=>$_POST['quantity_'.$_POST['party_id'][$i]] ); print_r($insert_arr);die(); $this->modeladmin->insertdata("daily_orders",$insert_arr); } } redirect(base_url().'daily_orders'); } modeladmin :- function insertdata($tablename, $postdata){ $created_by = $this->session->userdata('admin_data'); $created_on = date('Y-m-d H:i:s'); $postdata['created_by'] = $created_by; $postdata['created_on'] = $created_on; if($this->db->insert($tablename, $postdata)) { return true; }else{ return false; } }
  3. hello everyone i want to help on this code i create table form i want to add product_name,party_name as same as add quntity in particular name simply way i add whole table in db <form action="<?php echo base_url(); ?>daily_orders/do_add" id="frmvalidate" method="post" role="form" enctype="multipart/form-data"> <div class="box-header"> <div class="row"> <div class="col-lg-2"> <input type="date" name="order_date" class="form-control" value="<?php echo date('Y-m-d'); ?>"> </div> </div> </div> <div class="box-body table-responsive"> <table class="table table-bordered table-condensed table-hover table-striped" width="1200px;"> <thead> <tr> <th style="color: #d81b60;"> Party Name \ Product Name</th> <?php foreach ($products as $key => $value) {?> <th> <input type="text" name="product_name[]" class="form-control" value="<?php echo $value['product_name'].' - '.$value['quantity'].' '.$value['unit_measurmrnt']; ?>" readonly> </th> <?php } ?> </tr> </thead> <tbody> <tr> <?php foreach ($party_master as $key => $value) {?> <tr> <th> <input type="text" name="party_name[]" class="form-control" value="<?php echo $value['party_name']; ?>" readonly> <input type="hidden" name="party_id[]" value="<?php echo $value['id']; ?>"> <?php foreach ($products as $key => $value1) { ?> <th><input type="text" name="quantity_<?php echo $value['id'] ?>_<?php echo $value1['id'] ?>" class="form-control" placeholder="quantity"></th> <input type="hidden" name="product_name_<?php echo $value['id'] ?>_<?php echo $value1['id'] ?>" value="<?php echo $value1['id']; ?>"> <?php } ?> </tr> <?php } ?> </tr> </tbody> </table> <div class="box-footer"> <button type="submit" class="btn bg-maroon btn-flat pull-right">Submit</button> </div> </div> </form> function do_add() { $cng=count($_POST['party_id']); for ($i=0; $i < $cng; $i++) { $cng1=count($_POST['product_name_'.$_POST['party_id'][$i]]); for ($m=0; $m < $cng1; $m++) { $insert_arr = array( 'party_id'=>$_POST['party_id'][$i], 'order_date'=>$_POST['order_date'], 'party_name'=>'', 'product_name'=>'', 'quantity'=>$_POST['quantity_'.$_POST['party_id'][$i]] ); print_r($insert_arr);die(); $this->modeladmin->insertdata("daily_orders",$insert_arr); } } redirect(base_url().'daily_orders'); }
  4. another page data redirect to second page reminder_date notification before 7 days echo name & reminder_date i want php code
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.