-2

in codeigniter I have to post an two-dimensional array array[$index][$index] to some variable.

How do I post the value from the array on $val[$index][$index];?

I have to try with some code like this, but didnt work corectly :

$val[$x][$y] = $this->input->post('criteria'[$i][$j]);

Any thoughts on how I should try to get this working?

Thanks!

Dacaspex
  • 669
  • 7
  • 15

1 Answers1

1

In an html Form you can add a field with name having double square brackets. Like:

<input name="myVal[][]" />

Then post this into a form to php. In you php file write:

echo '<pre>';print_r($_POST);'</pre>';

You will see posted fields there. You can get this posted data in codeigniter using:

 $this->input->post('myVal');
Umair Hamid
  • 3,509
  • 3
  • 23
  • 25