开发者

MVC for web development: Sign-up form?

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 no开发者_Python百科t 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜