Okay, I will explain this the best I can.
First, the way this is layed out is. I have a main controller that loads blog entries on the home page, inside that controller is also a function that loads the comments_view for each blog entry when you load the comments. On the comment page is a form that will let you add a new comment, this form has validation and other data. The problem I have is the form points to another controller which handles the validation which works fine, but if validation fails I need it to load the view and load the data for that blog entry, which works via entry_id. Now, the issue at hand here is that when something fails I don’t know how to load the view with the data for that ID. I’ve tried a few different ways to do this. Below part of my code to try to help with explaining the issue. Thanks.
Comment’s Load Function:
function comments()
{
$data['base_url'] = $this->config->item('base_url');
$this->db->where('entry_id', $this->uri->segment(3));
$data['query'] = $this->db->get('comments');
$fields['comment'] = 'Username';
$fields['name'] = 'Password';
$fields['email'] = 'Email Address';
$this->validation->set_fields($fields);
$this->load->view('pages/comment_view', $data);
}
Comment Submit code (only the part of the code that is the problem)
if ($this->validation->run() == FALSE)
{
$data['base_url'] = $this->config->item('base_url');
redirect('home/comments/'.$_POST['entry_id']);
//neither of these work
$this->load->view('pages/comment_view', $data);
}
If your lost or confused on the issue tell me so I can try to explain this better. Thanks for any help you can give! ![]()
