Welcome Guest, Not a member yet? Register   Sign In
Are $this->input->post() and set_value interchangeable?
#1

[eluser]RS71[/eluser]
Hey

Are $this->input->post() and set_value() interchangeable? I can't seem to use $this->input->post() when I want to retrieve an array value (ex: field[0] ). It returns nothing for some reason, even though the array has things in it.

Thanks
#2

[eluser]RaF007[/eluser]
I might be wrong but I think you can only grab the whole array at once using $this->input->post(). Let's say your POST contains an array FIELD containing several values (FIELD[0], FIELD[1], ...), you would have to do the following:

Code:
// WILL NOT WORK
echo $this->input->post('FIELD[0]');

// THIS SHOULD WORK
$myarray = $this->input->post('FIELD');
echo $myarray[0];
echo $myarray[1];

If I'm incorrect, I'm interested into seeing a solution for this as well.
#3

[eluser]xwero[/eluser]
With the previous validation library the validation->fieldname and input->post('fieldname') were interchangeable but the new library doesn't alters the post values anymore.




Theme © iAndrew 2016 - Forum software by © MyBB