• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.