php - Adding outputted table row to another table using codeigniter -
outputted row table ,am trying add of contents table using form inside outputted row not inserted database. not getting error.
here view
<?php foreach ($h->result() $row) {?> <div class="row invoice-info"> <div class="col-sm-1 invoice-col"> </div> <div class="col-sm-3 invoice-col"> <img src="<?php echo base_url()?>/res/images/goods/1.png"> </div> <div class="col-sm-4 invoice-col"> <address> description: <?php echo $row->description;?><br> location address: <?php echo $row->l_area;?><br> destination address: <?php echo $row->d_area;?><br> date: <?php echo $row->dom;?><br> time: <?php echo $row->tom;?> </address> </div> <div class="col-sm-2 invoice-col"> <address> </address> </div><!-- /.col --> <div class="col-sm-2 invoice-col"> <form action="<?php echo site_url('truckeraccount_ctrl/bid'); ?>" method="post"> <input type="hidden" class="form-control" name="truckerid" value="<?php $truckerid = $this->session->userdata('truckerid'); echo $truckerid; ?>" required> <input type="hidden" class="form-control" name="luggage_id" value="<?php echo $row->luggage_id;?>" placeholder="bid"> <input type="text" class="form-control" name="bid_amount" placeholder="bid"> <button type="submit" class="btn bg-orange btn-flat margin">place bid</button> </div> </div>
my model
function bid($data){ $query=$this->db->update('bids',$data); return $query; }
my controller
public function bid(){ $this->load->database(); $this->load->model('truckeraccount_model'); $data['a']=$this->truckeraccount_model->accepted_bid(); $data['b']=$this->truckeraccount_model->picked_loads(); $data['h']=$this->truckeraccount_model->loads(); $data['g']=$this->truckeraccount_model->notification(); $data['i']=$this->truckeraccount_model->return_loads(); $data['accepted_return_loads']=$this->truckeraccount_model->accepted_return_loads(); $data['bid_amount']=$this->truckeraccount_model->bid_amount(); $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); $this->form_validation->set_rules('bid_amount', 'bid_amount', 'required|min_length[1]|max_length[50]'); if ($this->form_validation->run() == false) { $this->load->view('header'); $this->load->view('truckeraccount_view',$data); $this->load->view('footer'); } else { $data = array( 'truckerid' => $this->input->post('truckerid'), 'luggage_id' => $this->input->post('luggage_id'), 'bid_amount' => $this->input->post('bid_amount'), ); $this->truckeraccount_model->bid($data); $data['message'] = ''; redirect('truckeraccount_ctrl/'); } }
<form action="<?php echo site_url('truckeraccount_ctrl/bid'); ?>" method="post"> <input type="hidden" class="form-control" name="truckerid" value="<?php $truckerid = $this->session->userdata('truckerid'); echo $truckerid; ?>" required> <input type="hidden" class="form-control" name="luggage_id" value="<?php echo $row->luggage_id;?>" placeholder="bid"> <input type="text" class="form-control" name="bid_amount" placeholder="bid"> <button type="submit" class="btn bg-orange btn-flat margin">place bid</button> </form>