Usama Iftikhar
Usama Iftikhar

Reputation: 183

Get POST values by index in codeigniter

When I write this line

$this->input->post('question')

it returns me this

array(3) {
  [0]=>
  string(14) "eeeeeeeeeeeeee"
  [1]=>
  string(17) "fffffffffffffffff"
  [2]=>
  string(14) "gggggggggggggg"
}

I want index[1] value, like want to convert this:

$_POST["question"][$i]

into CI syntax

Upvotes: 0

Views: 523

Answers (2)

radhouen
radhouen

Reputation: 21

$data = $this->input->post('some_data');

Try this from CodeIgniter site

Upvotes: 0

Xpleria
Xpleria

Reputation: 5873

You can save the entire array like this

$post_array = $this->input->post();

Then use $post_array in the same way as $_POST

or

$question = $this->input->post('question')
$question[$i]

Upvotes: 3

Related Questions