[eluser]Unknown[/eluser]
Hello once again, CI community. A week spent in the shoes of a Developer ( in my lifetime, yes! )and here is what I have:
I worked out a lot with my app and now there are these small things which need to be added/modified or removed... I need your help changing one.
What I have right now: On creating a new post, I have set the user to redirect to the homepage where he/she sees all posts with the newly created post right on top of the list... This is cool if one user is using it, but this won't be good user experience if say 5 users make new posts and get redirected to the home page ( say with a minor difference of a few seconds).
What I want to achieve : On creating a new post, I would like the user to be redirected to the the post he/she just created. Say he/she is redirected to example.com/posts/89 (where 89 is the new post's post-id).
I have listed out my controller and model below.
CONTROLLER
When the validation part is all TRUE and all data submitted for the post is verified by the user, this is what happens:
Code:
else {
$this->load->model('create_model');
if($query = $this->create_model->create_event()) {
redirect('site');
}
MODEL
Code:
$insert = $this->db->insert('event', $new_event_insert_data);
return $insert;
I'm guessing this has something to do with the Redirect part and might be really simple, but I'm not getting that logic right. Please help me out with this one.
Thanks.