I am using PHP MVC pattern without any Framework, right now i have a view file with some data to be inserted into it, which will be save into the database. now my problem is how to connect the view file to the controller or Model.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The view shouldn’t save anything to the database, that’s the job of the model. The view is for rendering only. Typically, you’ll instantiate a view object in your controller, pass it the data you want to render, then call some render method. Perhaps something like this:
If you want to save the data in the database, that’s got nothing to do with the view. You might have something like this: