Reputation:
How to map post data to variables
handy.php
if($this->input->method() === 'post') {
$obj = json_decode($this->input->raw_input_stream);
print_r($this->input->raw_input_stream);
print_r($obj);
$name = $obj->name;
$mobile = $obj->mobile;
$state = $obj->state;
}
Upvotes: 0
Views: 284
Reputation: 2468
In codeigniter If you are sending xyz = 'some_value'
using post you can set that POST value in variable as
$xyz = $this->input->post('xyz');
Your code should look like:
if($this->input->post()) {
$name = $this->input->post('name');
$mobile = $this->input->post('mobile');
$state = $this->input->post('state');
}
Assuming that you have sent some data for name, mobile and state
. You can clear notices at your own.
Upvotes: 1