tags:

views:

33

answers:

1

How would I go about implementing a signup form using the MVC pattern for a website (I'm using PHP)?

I think the controller should receive the POST data initially. Then probably some interation with the model might need to take place (if the user successfully signs up). Then I think the signup form view would be called, and a value would be passed in saying whether or not the signup was successful.

Stuff I need help with:

  • Where do I do input validation (ie. proper email address formatting)? How do I check to make sure the username is unique?

  • Is the rest of my description alright?

  • How would you go about doing an MVC website signup form?

+2  A: 

Where do I do input validation (ie. proper email address formatting)? How do I check to make sure the username is unique?

This should go in controller too. Most MVC frameworks have a validation class.

Is the rest of my description alright?

Yes you are as per the standards of MVC.

How would you go about doing an MVC website signup form?

When the form is submitted, It processes and gets validated in the controller, and the model is called from controller to save user info into the database. After that controller calls a redirect to send the user to specified page.

Sarfraz