I am stuck how to repopulate a hidden field in a form after an unsuccessful form validation.
The repopulation uses set_value() function to print out the chosen value for other fields, but with the hidden field, there is already something printed in the value field.
Here is my view code:
<? echo validation_errors();?>
<? echo form_open('projects/start');?>
<input type="hidden" name="project_type_id" value="<? echo $this->uri->segment(3);?>" >
<input type="text" name="site" value="<?echo set_value('site');?>">
<input type="submit" value="submit">
<?echo form_close();?>
Pass the URI segment value in second parameter, after submit the form it will take the submitted value, It repopulate submitted value not URI segment value.
Hope this helps you. Thank you.