How to screen $_POST data before inserting into database? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: How to screen $_POST data before inserting into database? (/showthread.php?tid=9285) |
How to screen $_POST data before inserting into database? - El Forum - 06-19-2008 [eluser]Tony W[/eluser] I am very new to CI and just started coding. I have read the user guide but still don't know how to do screen the POST data before saving to database? I only know this for mysql insertion: $this->db->insert('db_table', $_POST); How do you screen the data such as: confirm if the passwords (1st entry and confirm) are identical? add captcha. etc... Thanks! How to screen $_POST data before inserting into database? - El Forum - 06-20-2008 [eluser]Taff[/eluser] Hey Tony, check out the validation class. http://ellislab.com/codeigniter/user-guide/libraries/validation.html That should be what you need. Scroll down to Prepping data where you will see Quote:$rules['username'] = "trim|required|min_length[5]|max_length[12]|xss_clean"; which will give you a basic idea of how it works. Taff |