[eluser]Colin Williams[/eluser]
I think set_value() is a fairly useless function, especially when using a form view that is either populated with submitted results or populated with default values. $_POST is already a key => value data structure, and what you return from your model is likely a key => value structure as well. Given that, consider this kind of code in an edit function:
Code:
$form['values'] = get_blog_post_array($id);
if (count($_POST))
{
$form['values'] = $this->input->xss_clean($_POST);
}
Then in your view, you access values via $values['key']:
Code:
<input type="text" value="<?php print form_prep($values['title']) ?>" name="title" />
<textarea name="body"><?php print htmlspecialchars($values['body']) ?></textarea>
You can also do some more general sanitizing in your controller if you wish (like form_prep(), etc).