Mail form - the best way?
Posted: Thu Oct 10, 2002 12:52 am
Hi all,
I am in the middle of creating a mail form that captures information from
a user > validates it (if ok) mails the info and goes to a thankyou page.
Now I have planed to create the following pages,
‘Main.php’ [the page where the blank original form is located on]
This submits to ‘send_feedback.php’ for validation and mailing..
Now, this is where I am stuck on how to handle this..
The functionality I want is;
If the form is incomplete or does not validate correctly, I want to take the user to a page that has the same structure as ‘main.php’, say it is called ‘error_feedback.php’ but it retains all the inputted text and selected options the user input on the ‘main.php’ page.
I then want to but an red star ‘*’ next to the field in error and display an error message containing a list of the errors contained within the form and an explanation of how the user should remedy the errors and resubmit the page again.. (maybe back through send_feedback.php) for revalidation and to sent the info via mail..
Now, this is what I am confused about, should I,
Which is the best way to do this???,
1. Storing all the values in a session variables (there currently aren’t any other session running on the site).
2. Pass all the values into a DB (mysql and retrieve them when I need them to be populated back into the error filled form)
3. Use an array to the same thing as the above
4. There is an option I have not considered but you know about that would be perfect for this type of thing..
Simpler the solution, the better for me..
Let me know what you think I should do, (in detail, code examples would be great, hint), and why you would use the method you think is best..
Any help on this would be very much appreciated..
Maybe if this thread gets a lot of good answers, it could be referred to when others have the same problem….
Thanks in advance..
Lukenet
I am in the middle of creating a mail form that captures information from
a user > validates it (if ok) mails the info and goes to a thankyou page.
Now I have planed to create the following pages,
‘Main.php’ [the page where the blank original form is located on]
This submits to ‘send_feedback.php’ for validation and mailing..
Now, this is where I am stuck on how to handle this..
The functionality I want is;
If the form is incomplete or does not validate correctly, I want to take the user to a page that has the same structure as ‘main.php’, say it is called ‘error_feedback.php’ but it retains all the inputted text and selected options the user input on the ‘main.php’ page.
I then want to but an red star ‘*’ next to the field in error and display an error message containing a list of the errors contained within the form and an explanation of how the user should remedy the errors and resubmit the page again.. (maybe back through send_feedback.php) for revalidation and to sent the info via mail..
Now, this is what I am confused about, should I,
Which is the best way to do this???,
1. Storing all the values in a session variables (there currently aren’t any other session running on the site).
2. Pass all the values into a DB (mysql and retrieve them when I need them to be populated back into the error filled form)
3. Use an array to the same thing as the above
4. There is an option I have not considered but you know about that would be perfect for this type of thing..
Simpler the solution, the better for me..
Let me know what you think I should do, (in detail, code examples would be great, hint), and why you would use the method you think is best..
Any help on this would be very much appreciated..
Maybe if this thread gets a lot of good answers, it could be referred to when others have the same problem….
Thanks in advance..
Lukenet