Welcome Guest, Not a member yet? Register   Sign In
Use foreach for input->post() ?
#1

[eluser]snoo[/eluser]
Hi guys,

I have a form that has couple of input fields that may or may not be available depending on user input. Normally I use

Code:
foreach($_POST as $k=>$v){

}

Is this a recommended practice in CI?

Can I use
Code:
foreach($this->input->post() as $key=>$value)
{
if($key != 'submit'){
  $data[$key] = $value;
}
}

$insert = $this->db->insert('database', $data);

thanks!




Theme © iAndrew 2016 - Forum software by © MyBB