![]() |
foreach help needed!! - 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: foreach help needed!! (/showthread.php?tid=31554) |
foreach help needed!! - El Forum - 06-23-2010 [eluser]sumit270[/eluser] Code: $data = array( Code: if ($this->form_validation->run('jobs') == FALSE) { foreach help needed!! - El Forum - 06-23-2010 [eluser]Buso[/eluser] Code: $data = $_POST; i don't understand why you have to declare everything Also, there is a redirect at the end.. Why are you displaying anything if you are going to redirect? It's going to throw an error foreach help needed!! - El Forum - 06-23-2010 [eluser]sumit270[/eluser] thank you it worked perfectly. so any drawbacks to this method? foreach help needed!! - El Forum - 06-23-2010 [eluser]sumit270[/eluser] i was following some tutorials, now i am just optimizing my code, so it is reuseable.. i am also looking for a way to put all my option arrays somewhere else. foreach help needed!! - El Forum - 06-23-2010 [eluser]Burak Guzel[/eluser] [quote author="sumit270" date="1277362649"]thank you it worked perfectly. so any drawbacks to this method?[/quote] Yes, it's not a safe approach in general. Let's say you have an "Edit Profile" page. And let's say the users table has a field named "access_level", which is not meant to be updated by the user himself. But the user messes with the form and sends this: $_POST['access_level'] = 'super admin'. Your script will automatically update that field because you copy $_POST to your $data array, which goes into the query. foreach help needed!! - El Forum - 06-23-2010 [eluser]sumit270[/eluser] excellent point. thank you. i am just using this method for the general submission, so this short method should be fine. but if i have to write for admin or login system, i will keep that is mind. thank you so much. |