douzi7890 2009-01-19 14:07
浏览 56
已采纳

在许多页面上组织了许多表格

I have a web app I'm building that has about 50 forms.

I have a very nice form-building class that handles the creation and submission of these forms very nicely and it's wrapped with error handlers, etc. No help needed there.

However, the forms are scattered through 120 pages. I could really use some weigh in from you guys about the ideal organization structure for these pages/forms. Here are some ideas. Both have pros and cons.

  1. Each page, in the header, creates the form there detects the presence of a $_POST['action'] variable and processes the forms there.

  2. Each form is built by a function in a form functions file and returns the form object when it's called in the header of the page, and when processing, since $_POST is a superglobal the processing functions is called in the header of the page as well.

  3. For each page such as profile.php include a file in the header that includes a profile.forms.php in which the method #1 or #2 above happens.

Ideas?


Just a note, there will rarely be more than one form per page.

  • 写回答

2条回答 默认 最新

  • duanjiebian6712 2009-03-19 03:40
    关注

    Skuta I appreciate your help. I ended up using #2 and after fleshing out the entire project I was extremely happy with the results. It was flexible and consistent in its implementation and I was able to easily bring on other coders to the project with a minimal amount of training.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?