CodeIgniter Forums
i need to know the 2 kind of forms , which one is More functional ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: i need to know the 2 kind of forms , which one is More functional ? (/thread-73972.html)



i need to know the 2 kind of forms , which one is More functional ? - Noor - 07-01-2019

i need to know the 2 kind of forms , which one is More functional ?

 1) <form></form> ,  

 2) <?php echo form_open(''); ?><?= [font=Menlo][b]echo form_close();?>[/b][/font]


[font=Menlo]again i need to ask which one is more functional , and i need input type date how to use it in 2nd one form ?[/font]


RE: i need to know the 2 kind of forms , which one is More functional ? - ubayedtanvir - 07-01-2019

The main difference between hard coding form tags and using built in form helpers is, form helpers will automatically escape special characters to display form value where you have to manually use "html_escape()" function to escape special characters.

Secondly, If you are more comfortable with PHP than hard coding HTML within PHP, then form helpers will help you generate custom forms.

You can always read the official documentation for further information.


RE: i need to know the 2 kind of forms , which one is More functional ? - neuron - 07-01-2019

use form_open function mainly for the reason that has CSRF protection if you ever will need it.


https://www.codeigniter.com/user_guide/libraries/security.html?highlight=csrf#id2

if in future you will need to enable CSRF protection you won't have to change all hard coded <form> tags to form_open().

for the input/select fields I just hard code them.