I am trying to create a data-entry,with controller which inputs the data, displays it and confirm for any edit then uses a method to submit it to the model.
The problem is that in the load the model in the function post_data()
the value of $this->input->post()
return an empty array.
I am entering the data returning to the get_data function and then displaying it in the data.php in the view.
using
data.php in view post the data to the post_data method.
<form id='form' action="<?php echo base_url("welcome/post_data"); ?>" method="POST" style="display:inline;">
<input type="text" name="xyz" value="<?php echo $this->input->post("xyz") ?>" />
the controller is
protected $arr;
public function index(){
$this->load->view('index/index');
// $this->load->library('Controllerlist');
// print_r($this->controllerlist->getControllers());
}
public function get_data(){
echo "matoercod";
$this->load->view("index/data");
}
public function post_data(){
$this->load->model("form1","form",TRUE);
print_r($this->input->post());
$blue=$this->form->insert_data($this->arr);
print_r($blue);
if($blue){
echo "Successfully added to database";
}
}}
Why does print_r() method return an empty array? $this->input->post() in the post_data method return empty array. if Iam right $this->input->post() should is global to all the method in Controller CI class.