forms and form handler, multiple pages or one?
Posted: Sun Jul 31, 2005 1:41 am
When you have a simple form, let's say a contact us form do you usually:
A) Make 2 pages, one with the html form and another page to handle the form data
or
B) Keep it in one page, output a hidden value into the html form, upon loading of this page we check if the hidden value has been set, if not we output the html form, if the hidden value has been set we run the portion of the code that handles the form.
What about multipart forms?
Do you tend to have:
A) form1.php form2.php form3.php form_handler.php
or do you tend to go with the:
B) form.php?part=1 form.php?part=2 form.php?part=3 form.php?part=process?
(but with post variables of course)
I usually opt for option B especially with multipart forms, just so I don't have a huge amount of php scripts sitting around. The only time I opt for A is when the form handler calls for very large amounts of code, it's just easier to have it in it's own file in some cases.
Share your methods / opinions
A) Make 2 pages, one with the html form and another page to handle the form data
or
B) Keep it in one page, output a hidden value into the html form, upon loading of this page we check if the hidden value has been set, if not we output the html form, if the hidden value has been set we run the portion of the code that handles the form.
What about multipart forms?
Do you tend to have:
A) form1.php form2.php form3.php form_handler.php
or do you tend to go with the:
B) form.php?part=1 form.php?part=2 form.php?part=3 form.php?part=process?
(but with post variables of course)
I usually opt for option B especially with multipart forms, just so I don't have a huge amount of php scripts sitting around. The only time I opt for A is when the form handler calls for very large amounts of code, it's just easier to have it in it's own file in some cases.
Share your methods / opinions