FRIHOSTFORUMSSEARCHFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Form Processing

 


Dennise
Can someone please confirm my understanding about form processing? Taking a PHP approach is the following true?

1. The form itself can be all hTML and not contain any PHP code.

2. The actual form processing (including sending form contents in an email) assuming PHP, is written in all in PHP.

3. The PHP form processing code must reside on a seperate page (i.e. file) within the hosting website.

Is the above correct?
ocalhoun
1- true
2- true
3- Not necessarily, but that's the easiest way to do it. The separate page would usually be a 'thank you, your form has been processed' type page, with that small part done in HTML, while the rest of the file contains code to process the form. (Note the 'your post has been submitted' page after posting on frihost ^.^)
(You could write the form page in php with different 'modes' mode 1 would be the default with a blank form, but if the page was loaded with data from the form sent to it, it would go to mode 2, which processes the form's data. You could, in fact, use this method to create an entire website (other than pictures) on a single php file, though I don't know why you'd want to.)
rvec
if you want to make point 3 complicated you could also say PHP can be used in the form, and form processing is done in PHP, but sending the actual mail is not done by php and you give the command to do so in php.

But to keep it all simple
1 true
2 true
3 true
Hogwarts
Dennise wrote:
3. The PHP form processing code must reside on a seperate page (i.e. file) within the hosting website.


First two are definitely true; and whilst it might make it a bit more complicated, it's generally better not to do this as it confuses form validation Sad
ocalhoun
Hogwarts wrote:
Dennise wrote:
3. The PHP form processing code must reside on a seperate page (i.e. file) within the hosting website.


First two are definitely true; and whilst it might make it a bit more complicated, it's generally better not to do this as it confuses form validation Sad

!?!?
As long as you use variable names that make sense, form validation should be as easy as ever on a separate php file.
Dennise
Hey all ............


Thanks for the replies. It sure helps understanding the 'big picture' before going forward with forms and forms validation.




Smile
Hogwarts
ocalhoun wrote:
Hogwarts wrote:
Dennise wrote:
3. The PHP form processing code must reside on a seperate page (i.e. file) within the hosting website.


First two are definitely true; and whilst it might make it a bit more complicated, it's generally better not to do this as it confuses form validation Sad

!?!?
As long as you use variable names that make sense, form validation should be as easy as ever on a separate php file.


Then how would you go about displaying the errors? Whack them in a session and redirect back to the previous page? That's bad practice, and putting the same form on two different pages is bad practice. Having a single file for it all, however, is much better from every angle.
Related topics

Form Processing Help. It is doing my head in
PHP Form Processing Problem
Form Processing Email Not Sent
Form Mail help........lol
Universal Form-Processing tool

How To : Secure Your PHP Website
Message boards
Anyone that can give me help/suggestions for forms?
Javascript help
Post value from one site to another site.

please please beta test it (PHP coders)
Help required with Captcha script
How to Reference Checkbox Selections?
Multiple email Addresses
PHP: Feedback form issues.. help =P
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Frihost Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.