Welcome Guest, Not a member yet? Register   Sign In
Catch all $ _POST fields In form
#1

[eluser]Unknown[/eluser]
Hello guys,

I have a form with several fields and I would like to know if there's a dynamic way to get all field values ​​without having to specify each one manually as in eg:

Code:
$members['name'] = $this->input->post('name');
$members['email'] = $this->input->post('email');

Maybe something like a foreach ...

Regards.
#2

[eluser]boltsabre[/eluser]
No idea what you're trying to do, but yes, you can use a foreach like:

Code:
foreach ($_POST as $key => $value) {
   $members[$key] = $value;
}
#3

[eluser]Massaki[/eluser]
$members = $this->input->post();

var_dump($members);
#4

[eluser]Unknown[/eluser]
Hi boltsabre,

That is what I was trying to do!

I thought that there was a CI way to do this, but the PHP foreach solve the problem.
Thanks.

Hi Massaki, good option too.
Thanks.





Theme © iAndrew 2016 - Forum software by © MyBB