Should I use CodeIgniter html or form helper class?

advertisements

Is it good for performance or security issue to use those class as we know that HTML should be in plain HTML.
e.g.

<input type='text' .... />

is better than

<?php
echo '<input type="text" .... />';
?>

Then why should we use

echo form_input('username');


Helper functions are provided only for ease they are not necessary to use it is always better to use simple html since using helper would definitely create a overhead on server on the other hand advantage of using these function is your code becomes minified e.g read this text that i have copied from their documentation

form_prep()

Allows you to safely use HTML and characters such as quotes within form elements without breaking out of the form. Consider this example:

$string = 'Here is a string containing "quoted" text.';

<input type="text" name="myform" value="$string" />
Since the above string contains a set of quotes it will cause the form to break. The form_prep function converts HTML so that it can be used safely:

<input type="text" name="myform" value="<?php echo form_prep($string);?>" />

Note: If you use any of the form helper functions listed in this page the form values will be prepped automatically, so there is no need to call this function. Use it only if you are creating your own form elements.