Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5935137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:12:41+00:00 2026-05-22T15:12:41+00:00

I am new to the world of coding and am having a hard time

  • 0

I am new to the world of coding and am having a hard time understanding what MVC is and how I can apply it to PHP. At the risk of this question being closed I have scoured the web for numerous articles however none of them explain them explain MVC in a way I can understand.

For example, I came across the article at Coding Horror – http://www.codinghorror.com/blog/2008/05/understanding-model-view-controller.html however I am unsure how I can apply it to PHP. I apologise for posting an ambiguous question earlier however I hope this question is more direct.

Let’s take a look at example that will hopefully help me understand. The objective is a user must complete a registration form that will have the details recorded in a database.

I currently have the following files
– a PHP file (i.e. with the extension PHP) with XHTML markup – There is no code in here as yet except XHTML mark-up
– a CSS file

I have also have a MySQL database

  1. How would develop the registration form using MVC?
  2. What files should I have?
  3. What folder structures would I have?

I am not looking for actual code but an example of how I would develop a MVC application.

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:12:42+00:00Added an answer on May 22, 2026 at 3:12 pm

    Folder structures are irrelevant. The main point of MVC is a logical separation.

    You should have one model, which takes care of your data. This includes storing data in the database (or elsewhere), validating the integrity of data (i.e. make sure all values are as you want them, no strings in fields where you want numbers etc.) and retrieving data.

    You should have a view, which just presents data to the user or gives the user an interface to interact with your application. That’s typically your files containing (X)HTML.

    Then you need a controller that makes these two things work together. The controller is responsible for receiving user requests, deciding what to do with them and rendering an appropriate view in response.

    These three parts can be realized in many ways (classes, objects, functions, files), as long as the logical separation is preserved. The logical separation makes things easier in the long run, since you always keep the core of the application (models) separate from the presentation (views) and can dynamically combine both in many ways (using controllers).

    The typical logical flow for a form would be:

    • controller renders a view containing a form
    • form is submitted to controller
    • the controller tries to save the data using the model
    • the model validates the data, gives thumbs down if it is invalid or thumbs up if it was saved correctly
    • if thumbs down, the controller outputs an error message
    • if thumbs up, the controller redirect the user along to the next step

    Visualized it’s something like this:

    Request --> Controller --> View --> Response
                  |   ^
                  v   |
                  Model
                  |   ^
                  v   |
                 Database
    

    I suggest you start playing around with an existing MVC framework to get the feel for it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been having a hard time coming up a solution with this one. I'm
I am new to the world of coding as well as CSS. Having read
Im very new to all coding including jquery. I though this would have been
I'm self teaching myself to do MySQL and PHP. It is a new world
I am new to spring MVC coming with experience using PHP MVC frameworks and
I am new to the world of coding as well as XHTML. I am
I am having a weird issue in ASP.NET MVC with objects not being updated
I am new to posting and relatively new to coding in c++. My question
I'm rather new to github social coding and are having trouble following github guidelines.
I'm new to php and web coding so any help would be great. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.