Jump to content

Forms (Multi-Form, Single Form)


Ninjakreborn

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/211510-forms-multi-form-single-form/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.