[eluser]MattKern[/eluser]
Hi
I worked thru the tutorials and while expanding on those I ran into a problem.
This is the blog video tutorial
Code:
function comments()
{
//all the code that pulls the blog comments out of the table
$this->load->view('comment_view',$data);
}
function comment_insert()
{
//code to insert new comments into the table
redirect('blog/comments/'.$_POST['entry_id']);
}
This all works swell but now I am trying to add validation and I am getting all messed up.
I assume I add the actual validation code to the comment_insert function, but then I have to add the display validation messages to the comments function, right? Do I lose my validation data when redirecting from comment_insert to comments?
Also, in comment_view I get a bunch of notices about undefined properties and variables. I assume this is because I have validation code in comment_insert.
My knee jerk reaction is to move everything to the comment function and just check if the form has been submitted before I validate, but I am trying to learn how to write cleaner code.
Thanks
Matt