[eluser]Peter Lachky[/eluser]
Hi everybody,
I am coding a CRUD application and I need, of course, re-populate the form in case the validation fails. For text fields I use this code in my view:
Code:
<input type="text" name="name" id="name" value="<?php echo set_value('name') ?>" />
However, I can use this code with the very same effect:
Code:
<input type="text" name="name" id="name" value="<?php echo $this->input->post('name') ?>" />
My question is what is the point/advantage of using set_value() function? Am I missing anything?
The problem is actually a little bit complicated as I am trying to use the same form for add and edit functionality, so the actual code reads:
Code:
<input type="text" name="name" id="name" value="<?php echo set_value('name') ? set_value('name') : $name ?>" />
where $name is a variable containg the database value in case of editing.
Thanks for advices.