[eluser]zedd45[/eluser]
[quote author="xwero" date="1244748429"]I like following simple function to repopulate form fields
Code:
function value_field($field,$default='')
{
return (isset($_POST[$field])) ? $_POST[$field] : $default ;
}
No messing around with validation rules.[/quote]
I really like this solution. I wonder if this is more CI friendly, though:
function field_value($field,$default='') {
$CI =& get_instance();
$value = $CI->input->get_post($field, true);
return false === $value || '' === $value ? $default : $value;
}
This way you tie into CI's native Input class.
you could use post instead of get_post if you were not concerned with GET[];