Welcome Guest, Not a member yet? Register   Sign In
How to structure this
#1

[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


Messages In This Thread
How to structure this - by El Forum - 07-19-2007, 11:32 AM
How to structure this - by El Forum - 07-19-2007, 12:13 PM
How to structure this - by El Forum - 07-20-2007, 02:43 AM
How to structure this - by El Forum - 07-20-2007, 02:03 PM
How to structure this - by El Forum - 07-20-2007, 03:52 PM
How to structure this - by El Forum - 07-21-2007, 09:46 PM
How to structure this - by El Forum - 07-22-2007, 04:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB