CodeIgniter Forums
Form validation and re populating form from database - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Form validation and re populating form from database (/showthread.php?tid=56174)



Form validation and re populating form from database - El Forum - 12-01-2012

[eluser]seba22[/eluser]
Hello,

I have 2 question about populating form using form validation and database.

So i have same form, what i use for editing / saving value to database.

When it's not submitted, it's loading value form database.
When user save form, its run validation and populate values when submitted.



1) Is

Code:
<input type="text" name="admin_title" value="<?php echo set_value('admin_title','abc'); ?>" >

Is this code is safe for evil user input ?
php, xss, " ' - etc tags - code ?

If no, what should i do, where i should put that htmlspecialchars() ?

2)

Can i use set_value('admin_title',$something);

$something for populate value from database ?
Is this right way ?


Regards