Advertisement
Guest User

Untitled

a guest
May 25th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. <div class="col-lg-6">
  2. <?php
  3. // $getNameValue is the session value passed
  4. $getNameValue = $this->session->userdata('nameValue');
  5. echo '<h3>' . $getNameValue['name'] . '</h3>';
  6.  
  7. $getValue = $this->session->userdata('sessiondata');
  8. if ($getValue != NULL) {
  9.  
  10. echo '<table class="table table-bordered table-striped">';
  11. echo '<tr>';
  12. echo '<td><strong>Product Name</strong></td>';
  13. echo '<td><strong>Unit</strong></td>';
  14. echo '<td><strong>Cost</strong></td>';
  15. echo "<form method='post' action=''>";
  16. foreach ($getValue as $row) {
  17. echo '<tr>';
  18. echo '<td><input type="hidden" name="allProduct[product_name][]" value="' . $row['product_name'] . '">' . $row['product_name'] . '</td>';
  19. echo '<td><input type="hidden" name="allProduct[unit][]" value="' . $row['unit'] . '">' . $row['unit'] . '</td>';
  20. echo '<td><input type="hidden" name="allProduct[cost][]" value="' . $row['cost'] . '">' . $row['cost'] . '</td>';
  21. echo '</tr>';
  22. }
  23. echo '<tr><td></td><td><td><button type="submit" class="btn btn-success">POST</button></td></td></tr>';
  24. echo "</form>";
  25. echo '</table>';
  26. }
  27.  
  28. ?>
  29.  
  30. </div>
  31.  
  32. public function newSystemBatch($getBatch)
  33. {
  34. if ($data = $this->input->post('systemProduct')) {
  35.  
  36. $data['batch_id'] = $getBatch;
  37.  
  38. $productName = $data['product_name'];
  39. $unit = $data['unit'];
  40. $cost = $data['cost'];
  41.  
  42. $getValue = $this->session->userdata('sessiondata');
  43. $getValue[] = array(
  44. 'product_name' => $productName,
  45. 'unit' => $unit,
  46. 'cost' => $cost
  47.  
  48. );
  49. $this->session->set_userdata('sessiondata', $getValue);
  50. redirect('inventory/newSystemMessage/' . $getBatch['batch_id']);
  51.  
  52. }
  53.  
  54. if ($data = $this->input->post('allProduct')) {
  55. $this->header();
  56. $this->footer();
  57. $this->transaction->addNew($data);
  58. $this->load->view("admin/newSystemTable", $data);
  59. }
  60.  
  61. else {
  62. $this->header();
  63. $data['action'] = 'System';
  64. $data['users_id'] = $this->user->users_id;
  65. $this->load->view("admin/newSystemTable", $data);
  66. $this->footer();
  67. }
  68. }
  69.  
  70. function addNew($data)
  71. {
  72. $this->db->insert_batch('try',$data);
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement