Codeigniter: How to build an edit form that uses form validation and re-population?
- by Sergio
Hi There,
I have a simple form in codeigniter that I wish to use for the editing or records.
I am at the stage where my form is displayed and the values entered into the corresponding input boxes.
This is done by simply setting the values of said boxes to whatever they need to be in the view:
<input type="text" value="<?php echo $article['short_desc'];?>" name="short_desc" />
But, if I wish to use form_validation in codeigniter then I have to add thos code to my mark-up:
<input value="<?php echo set_value('short_desc')?>" type="text" name="short_desc" />
So not the value can be set with the set_value function should it need to be repopulated on error from the post data.
Is there a way to combine the two so that my edit form can show the values to be edited but also re-populate?
Thanks