Contact Form Setup

These are setup instructions for the form code found at the Page Affairs website.

This form code assumes that your contact page (that is, the page on which your contact form appears) has a .php extension—being called something like contact.php or index.php.

Step One

Create a new folder on your site called /contact/ and upload the index.php file to that folder. (Then your visitors will be able to access your contact page at yoursite.com/contact/)

If you'd prefer to have your contact page at something like yoursite.com/contact.php, then simply rename index.php to contact.php and upload it to the root folder (home folder) of your site.

Step Two

In your /contact/ folder, create a new page called thankyou.html. Place your thankyou message in there. (You can make it like a regular page on your site—with the same styling etc.)

(If you aren't using a separate folder but just have your contact page in the root folder, then place your thankyou page in the root folder too.)

Step Three

Open the index.php in your code editor. You need to make a few simple changes to the top of the file.

In this line: $your_email = "name@mailhost.com"; // email address to which the form data will be sent you need to enter the email address to which the contact form data is to be sent. So, for example, if you are setting this form up for a client, enter the client's email address.

In this line: $subject = "Contact Message"; // subject of the email that is sent you need to enter the subject of the email, which will appear in the recipient's email client. (For example, it might read "Website Contact Message".)

In this line: $thanks_page = "thankyou.html"; // path to the thank you page following successful form submission you need to enter the name/URL of the thankyou page.

(If you want the thankyou page to appear at a URL like yoursite.com/contact/thankyou/, then name your thankyou page index.html, and place it in a folder called /thankyou/ inside the /contact/ folder. Then set the path to /contact/thankyou/.)

Extras

You can, of course, add more to the contact page and style it any way you like. Just be sure to leave all the code before the as is, and ideally leave the form HTML as is. (Most importantly, be sure to leave all the name="" values in the form code as is.)

If you have questions about this setup, post a question on the Page Affairs website.