PHP Contact Form (Captcha) Installation Instructions
This method is recommended if you want to include the contact form on any existing PHP page of your website (say your existing contact page). The limitation of this method is that you can only display a confirmation message and not redirect to any specific thank you page you may have. If you would rather access the contact form as a separate page, skip to Method II. Compared to this method, Method II is bit easier to implement.Open contact-config.php and edit the below 3 variables:
Change youremail@email.com to the email address where you wish the contact form messages to be delivered.
$subject_prefix = 'My Website Contact';
This will be the prefix that'll be attached to the subject of all contact form email messages.
$where_included = '';
You first have to select an existing PHP page on your website where you'll be displaying the contact form. This is the name of the file where you are including the contact form. If you don't have a PHP page, don't worry. You can simply rename your existing HTML page to PHP page. For example:
contact_us.html > contact_us.php
Note: The file where you are including the contact form and the rest of contact form files must be in the same directory.
So if you are including the contact form in a file called contact_us.php, then the above variable will be:$where_included = 'contact_us.php';
Now open the file where you are going to include the contact form, in this case contact_us.php, and put the below code to the place where you want the contact form to be displayed:
<?php include "contact.php"; ?>
Then add the below code to the very top of the same file:
<?php session_start(); ?>
That's it! Upload all the files to your server. If you load contact_us.php, the contact form should be visible.
Note: The purpose of $where_included variable is to define the action attribute of the form tag:
<form action="contact_us.php#cform">
Setting this variable incorrectly will display the form but give an error on submitting.
<form action="contact_us.php#cform">
Setting this variable incorrectly will display the form but give an error on submitting.
Method II
This method is recommended if you want to access the contact form as a separate page and would like to redirect users to a separate thank you page you may have. You can use this method even if you don't want to redirect users to a separate thank you page.1. Change:
$use_header_footer = FALSE;
to:
$use_header_footer = TRUE;
2. $thank_you_url = '';
Add the url to your thank you page to the above variable. Example:
$thank_you_url = 'http://www.yourdomain.com/thank_you.html';
3. Change:
$where_included = '';
to:
$where_included = 'contact.php';
Open contact-header.php and contact-footer.php and put your site header and footer information in them.
That's it! Upload all the files to your server. You can now access your contact form directly by visiting:
http://www.yourdomain.com/contact.php
or:
http://www.yourdomain.com/form/contact.php
depending on where you have uploaded the contact form files.