CodeIgniter Forums
$this->input->post() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: $this->input->post() (/showthread.php?tid=36241)



$this->input->post() - El Forum - 11-26-2010

[eluser]praveena[/eluser]
hi

I am new to codeigniter how to write $this->input->post as array
foreach($this->input->post() as $key )
{
$posts[]=$key;
}
return $posts;


$this->input->post() - El Forum - 11-26-2010

[eluser]InsiteFX[/eluser]
You can try this:
Code:
foreach($this->input->post() as $key => $val)
{
    $posts[$key] = $val;
}
return $posts;

InsiteFX


$this->input->post() - El Forum - 11-26-2010

[eluser]praveena[/eluser]
Message: Invalid argument supplied for foreach()

error for this


$this->input->post() - El Forum - 11-26-2010

[eluser]InsiteFX[/eluser]
Ok! My mistake, $this->input->post() needs parameters!
Code:
$this->input->post('some_data', TRUE);

It only returns one item that your looking for!

CodeIgniter Input Class

InsiteFX


$this->input->post() - El Forum - 11-28-2010

[eluser]praveena[/eluser]
Please can u elobrate this here some_data means the fiels names
$this->input->post('some_data', TRUE);