Installation - PHP Contact Form Script (responsive)
Download the contactform.zip file from my website at download.
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".
Now after all the files extracted to the folder "contactform" - close the software winrar/winzip.
Open the file "config.php" in the folder "contactform" with an editor of your choice (e.g. notepad2: http://notepad2.softonic.de).
Go down to line 2 and 3 and add your email address and your (company)name between the inverted comma.
Save the config.php file.
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.
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.
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.
With IFrame it is quite simple. Please just add the following code to your required page. <iframe src="contact.php" frameborder="0" width="550" 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".
Important: If you integrate the contact form responsive, width="100%" is required! The height can automatically adjusted by using this responsive iframe.
Now let´s go to the second possibility.
To add this contact-formular via php include command to an existing page it is required to have the file extension .php.
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.
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() ?>
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"); ?>
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"); ?
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"
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.
The contact form should be working now on page impressum.php.
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. ;-)
Help! The security code does not show.
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.
In my example it is: /home/www/
Mark the absolute path and copy it into the clipboard. (mark - right mouse button - copy)
Open the file captcha.php within the folder captcha and scroll down to line 64. ($ttf = "/Imperator.ttf";)
Important: Now insert the absolute server path from the clipboard before /Imperator.ttf.
In my example: $ttf = "/home/www/Imperator.ttf";
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. ;-)
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
It is very important that is PHP 5.2 installed on your server, when you use the contactform with securityquestion.
If your server has installed PHP 4 or older, please contact your webhoster. That change this free.
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.
- Do you need an individual inquiry form for your homepage? No problem! Write to us!