How-To: mail_form.php

This is an introduction and how-to document explaining how to use the email script mail_form.php. This script is provided as a service to friends of Spencer only. Any abuse of this script will result in the script bieng removed, or possibly deleted.


Intro

The mail_form.php script processes any form and will email the data to a specified email address, and provide a "thank you" page. You simply build your form, add a few hidden fields, and set the form action to the script, and then you're ready to go.
In your HTML code, you must start your form with this line:
This is line calls the right script when the Submit button is pressed in the form. The rest of the form is up to you. You can have what ever fields you want- but there are some special hidden fields that you must be careful with. These hidden fields change how the script works and you can customize the "thank you" page with some hidden fields.

Hidden Fields

In your HTML code, hidden form fields should be placed inbetween the <FORM ...> and the </FORM> tags. They should look like this:
Here are a list of the hidden fields used by the mail_form.php script:
FIELD NAME DESCRIPTION
your_email_address This is the email address that the script will send an email message to. You can have more than one email address here- just list them together separated by commas. (For example: VALUE="me@myplace.com, mybuddy@hisplace.com, myotherbuddy@herplace.com")
your_name This is the name of the main person who will be receiving the email message.
email_subject_line This is the email message subject line.
field_order This is the list of your own form fields in the order you want them to appear in the email message. (Example, VALUE="name,address,city,state,zip,phone,comments")
browser_info This can display on the "thank you" page what is being sent in the email message. To turn it on, set VALUE="on". To turn it off, set VALUE="" (nothing inside the quotes).
return_link_url This is the web page address to return to your web site.
return_link_name This is what you want the return link to say. (For example, VALUE="Click here to return to my web page.")
thank_you_title This is the short "thank you" page title. It will appear at the top of the page. (For example, VALUE="Thanks for requesting information. We will contact you as soon as we can.")
thank_you_message This is a short message that you can put on the "thank you" page.
required_fields This is a list of form fields that you want to require that the user fill in. If the user doesn't fill in every required field, then a message will be displayed saying which ones they missed. (Example, VALUE="name,email,phone,comment")
background_color This sets the background color for the "thank you" page.
background_image This sets the background image for the "thank you" page.
text_color This sets the text color for the "thank you" page.
link_color This sets the link color for the "thank you" page.
active_link_color This sets the active link color for the "thank you" page.
visited_link_color This sets the visited link color for the "thank you" page.

Notes

The mail_form.php script was written for general form processing to send email messages. There are many things it can't do. If there is something that you would like to add, or to change about the way it works, I'd be happy to consider it.

Contact

For problems or questions about mail_form.php, contact
Spencer Christensen
spencer@mecworks.com