Installation - PHP Contact Form Script

Text Guide

  1. Download the contactform.zip file from my website at download.

  2. Open the file contactform.zip (with winrar or winzip) and extract all the files from this archive to an folder of your choice on your harddisk-drive. In this case I name it "contactform".

  3. Now after all the files extracted to the folder "contactform" - close the software winrar/winzip.

  4. Open the file "config.php" in the folder "contactform" with an editor of your choice (e.g. notepad2: http://notepad2.softonic.de).

  5. Go down to line 2 and 3 and add your email address and your (company)name between the inverted comma.

  6. Save the config.php file.

  7. If you want to have an upload function for your visitors, open the upload.php file.

    By means of the annotation you can now set up the configuration for the uploadfield. Amongst others you have the option between sending files to your email address ( standard ) or via an upload to a folder on your server. Detailed information on all configurations you find with comments in the upload.php file.

  8. Upload all your files (including upload.php) on your server and open the file test.php in your browser. Enter your email address in this formular only to check if the mail function is set up correctly. After pushing the send button you should receive a test email within a few seconds. For security reasons please delete the test.php. Please move on to the next step.

  9. Now open the file contact.php with your browser. The contact form is now ready for use. If there is no security code visible then you will find a troubleshooting at the bottom of this page.


Integration in an existing page

There are two possibilities to add this php formular in your webpage. Either by I-Frame (very simple!) or with the php include command.

I-Frame

  1. With IFrame it is quite simple. Please just add the following code to your required page. <iframe src ="contact.php" frameborder="0" width="450" height="700"></iframe> The width and height of this inline frame can be customized as you wish. Please make sure that the path of the contact.php is correct. In case the file is stored in a folder (e.g. contacform) please change the path to: "contactform/contact.php".

  2. The width and height of this inline frame can be customized as you wish.

  3. Finish!

PHP Include

  1. Now letīs go to the second possibility.

  2. To add this contact-formular via php include command to an existing page it is required to have the file extension .php.

  3. Example: You want to add the contact-formular ( contact.php ) to your impressum ( impressum.html ). Before you start the process you need to rename the file impressum.html to impressum.php.

  4. Now open the file impressum.php with an editor and add at the first line of the file ( line 1 ) the following php code: <?php session_start() ?>

  5. Now add the following code to the required position in the impressum.php. to integrate the contact formular: <?php include("contact.php"); ?>.

    In case the file is stored in a folder ( e.g. contacformular ) please change code suitable. Based on the folder name contactform in our case it would be <?php include("contactform/contact.php"); ?>

  6. In case the file is stored in a folder ( e.g. contacformular ) please change code suitable. Based on the folder name contactform in our case it would be ?php include("contactform/contact.php"); ?

  7. Furthermore it is necessary to change the path to the captcha.php if the formular from our example is in the folder "contactform". Open the file contact.php with an editor and scroll down to the line 466, 467 and 468. In each case please change in line 466 and 467 the path to captcha.php. The path descriptions are marked in double quota. In our example with the folder name contactform you need to change the path to the captcha.php as following: "contactform/captcha/captcha.php". In line 468 change the path to icon-reload.gif into "contactform/icon-reload.gif"

  8. Additionally the file thankyou.php should also be copied in the same folder as impressum.php. As an alternative you can create a new danke / "thankyou" page.

  9. The contact form should be working now on page impressum.php.

  10. Do you want to have the impressum.php shown again as impressum.html in your browser then you need to create a file called .htaccess. This file has to be in the same folder as impressum.php. Please add the following content into the .htaccess file: RewriteEngine on RewriteRule impressum.html$ /impressum.php Now you can access the file impressum.php as impressum.html in your browser. ;-)

Some error-messages

Help! The security code does not show.

  1. If no security code is shown after installation please open the file document_root.php within the folder captcha in your browser. (not with the editor!) Now you see the absolute path of the server.

  2. In my example it is: /home/www/

  3. Mark the absolute path and copy it into the clipboard. (mark - right mouse button - copy)

  4. Open the file captcha.php within the folder captcha and scroll down to line 64. ($ttf = "/Imperator.ttf";)

  5. Important: Now insert the absolute server path from the clipboard before /Imperator.ttf.

  6. In my example: $ttf = "/home/www/Imperator.ttf";

  7. As the font is likely not in the root directory (main directory) of your server you need to amend the path. For example if the contact formular script is located in the folder contactform the path must look as follows: $ttf = "/home/www/contactform/captcha/Imperator.ttf"; Certainly you might not forget to mention the folder captcha as the font is deposited there. ;-)

  8. The security code should be shown up now.


I became this failure...: Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or \'}\' in /var/www/***/html/***/AntiSpam.php on line 17

  1. It is very important that is PHP 5.2 installed on your server, when you use the contactform with securityquestion.

  2. If your server has installed PHP 4 or older, please contact your webhoster. That change this free.

Info

With this script you can give your visitors the possibility to get in contact with you. This formular will be sent by mail to the webmaster. There is a security code to protect you against spam. Additionally there is an option to add an email attachment field. You are not allowed to remove the copyright endorsement in the footer of the script. If you want to remove copyright though you have to buy a non-copyright licence. For commercial use, you have to buy a commercial licence. For this please use the purchase order form.


Individual Formmailer

Do you need an individual inquiry form for your homepage? No problem! Write to us!