Error Submit button from the view does not pass the value.
After submit button is clicked, then pass value from view to controller, then to the model. Database structure consists of table(booking) and column name ( booked_id, name and mobile) . But the value is not passed to the controller neither to the database.
View
<form method="post" action="">
<input type="text" value="<?php echo isset($post)?$post->name:''; ?>" name="manakamana[name]"/>
<input type="text" value="<?php echo isset($post)?$post->mobile:''; ?>" name="manakamana[mobile]"/>
<button type="submit" class="btn btn-success">POST</button>
</form>
Controller
public function bookManakamana(){
if ($data = $this->input->post('manakamana')) {
$data['created_on'] = date('Y-m-d H:i:s');
$this->booking->add($data);
redirect('booking');
} else {
$this->load->view('index');
}
}
Model
function add($data)
{
$this->db->insert('booking', $data);
}