Ninjakreborn Posted August 23, 2010 Share Posted August 23, 2010 Which one is better for standards practices in PHP. 1. Using the same form for everything. (Add and edit). Meaning setting up one form to handle adding new records, as well as editing existing records. Or 2. Using two different forms for both actions. Use one form/area to handle Adding, and one form/area to handle editing. Which one of these are better from a standards/practice point of a view. Which one better fits into the MVC platform (a framework like Codeignitor, or Cake). Should their be separate controller functions/views for add and edit or should they all be in the same controller function/form. Thanks for the feedback. Quote Link to comment https://forums.phpfreaks.com/topic/211510-forms-multi-form-single-form/ Share on other sites More sharing options...
AbraCadaver Posted August 23, 2010 Share Posted August 23, 2010 I'm not sure if there is a standard. I've seen many professional projects do it both ways. As for Cake, if you use "Bake", their code generator, it creates a separate form template for add and edit, as well as a separate controller action for each. This makes more sense to me and helps keep the logic separate. Since all validation etc. will be done once in the model, then there is no code duplication. Quote Link to comment https://forums.phpfreaks.com/topic/211510-forms-multi-form-single-form/#findComment-1102769 Share on other sites More sharing options...
schilly Posted August 23, 2010 Share Posted August 23, 2010 I use to use two but now I normally just use one as I only need to update one form if changes are needed. Quote Link to comment https://forums.phpfreaks.com/topic/211510-forms-multi-form-single-form/#findComment-1102772 Share on other sites More sharing options...
Ninjakreborn Posted August 25, 2010 Author Share Posted August 25, 2010 Cool, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/211510-forms-multi-form-single-form/#findComment-1103667 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.