Welcome Guest, Not a member yet? Register   Sign In
$this->input->post() not working for me
#1

[eluser]RS71[/eluser]
Hello,

I am currently trying to use $this->input->post() in my controller but it doesn't seem to be working.

I currently have it so a select has a name of grau[] (an array).

In the controller, I try to do something like:

Code:
$data['grau_field'] = 'grau[]';

$data['education_count'] = count( $this->input->post($data['grau_field']) );

It doesn't seem to be showing the correct count, even though I can see that the POST values are there. (via the Profiler)

Could anybody please assist me?

Thanks in advance.
#2

[eluser]elvix[/eluser]
try removing the brackets from your grau_field value.
#3

[eluser]RS71[/eluser]
That would make the input not an array would it not? I need it as an array.
#4

[eluser]RS71[/eluser]
Ah I got it thanks.

I removed the brackets from the post() like you said.
#5

[eluser]RS71[/eluser]
Another question:

How can I retrieve a certain value from an array?

Code:
Array
(
    [0] => ABC
    [1] => XYZ
)

How can I get the value for the second key?
#6

[eluser]Colin Williams[/eluser]
$array[1]




Theme © iAndrew 2016 - Forum software by © MyBB