really noob question |
[eluser]winterain[/eluser]
Hello all! I've just gotten myself aqquinted to the MVC way and CI and coding my first site.. however I'm running into some quirks which I'm sure can be easily solved with some enlightening.. This is on a contact page which I have a Email form and a chatbox with insert chat form.. my code is currently structure like this (please correct structure if viable) Code: class Contact extends Controller { the problem is, after a user inserts and email or chat entry, the URI will appear as site/contact/insert_email or site/contact/insert_comment which is quite unsightly... Any advice on how to make it look like ' site/contact ' ? Or is this how it should look... using redirect('contact') will make the URI look correct, but it won't work because the validation error variables won't get passed on... also because of this, I have to call my chat db query again in the insert_email function or the query will not exist.. Thank you for your time!
[eluser]akkumaru[/eluser]
,,do you mean validation error messages? redirecting after DB CRUD is what I choose, about the error message, You can save it temporarily with Code: $this->session->set_flashdata('contact_error',"Your Error Message Here");
[eluser]kevinprince[/eluser]
The URL will always be the function your calling. So when the form posts to Contact/insert_chat it is there where the error occurs, as such when you call a view your still executing in that function. There are 2 ways if you really dont like this: 1) Put the refill of the form into the session global, redirect, have handling for said session data in your display create chat function which calls the form 2) Hack CI Routing (BAD) |
Welcome Guest, Not a member yet? Register Sign In |