PHP контактная форма сценария документация
1. Installation
Your PHP Version
First of all you need to know which version of the PHP you are running. You can either ask your host, check your control panel software, or do the following in order to find that out:
- Create a new file in your root directory, for example: /public_html/test.php
- Put just the following code in that file:
<?php phpinfo(); ?>
- Open the file in your browser: http://example.com/test.php, you'll see the version of the installed PHP.
- Delete the test.php
Unzip, edit, and upload
- Unzip the TO_UPLOAD.zip file on your computer.
- Edit the contact-form/include/contact-form-configuration.php using a text editor software* such as Notepad++ and save the file.
- The file contains some important instructions, please read them carefully.
- If you want to translate the interface or modify the form messages you should do it by editing the contact-form/include/contact-form-language.php as well, using a similar text editor.
- Look at the sample files or read the next section to see how you can easily add the contact form to any page.
- Once done with integration and everything upload all the files to your site, so that the /contact-form folder for example, would be located at /public_html/contact-form.
- Finally, navigate to http://example.com/contact.php and make sure the form is fine & dandy :) if something went haywire, contact our support via www.htmlpie.com/support.
* Very important: Make sure the coding type of your text editor is set to 'UTF-8 without BOM'.
1.1 How to add the form to a page
Let's suppose you have a plain HTML website already, here's how you can add the form to any page by just adding 2 lines of PHP code to the page:
- Please note; in most cases the contact form or any PHP code in general cannot run in a non-PHP file, such as a contact-us.htm. In order to make this happen, create a new file called .htaccess in the same folder as the contact-us.html then add the following code to the .htaccess and save it. If you already have a .htaccess file, simply add this code to the file.
<Files contact-us.html> AddType application/x-httpd-php .html AddType application/x-httpd-php .htm </Files>
(Contact your Web hosting provider, if a 500 Internal Server Error started to appear on your Website.)
If you don't already have a "Contact us" page, create a copy of one of your pages, remove the content parts and then rename the file to contact-us.
Tip: All the modern Web browsers have built-in Web development tools (press F12) that may help you find out which parts you should remove.
- Ok now the most important part:
Add the line below at the very top of the contact-us.html (or .php) meaning the first line, line #1.
<?php require_once('contact-form/include/contact-form-main.php'); ?>
Then, add this anywhere you want the form to appear: (obviously within the <body>)
<?php require_once('contact-form/contact-form.php'); ?>
Tip: if it's a HTML5 document, you should be looking for an <article> element. - That's it! navigate to the page at http://example.com/contact-us.html :)
Errors? Contact support via www.htmlpie.com/support
1.2 How to make it beautiful
The package you have purchased contains four styles that you can use in order to make your own beautiful styles. Here's how you can use any of these styles:
- Open one of the CSS files under the contact-form/css folder, you'll see a lot of lines start with #php-contact-form
- Copy all of these lines.
- Paste them in the main CSS file of your Website.
- Navigate to your Contact us page, start modifying the CSS and refresh the page after saving the CSS to see the changes.
- Need help? Contact support via www.htmlpie.com/support :)
1.3 How to upgrade
The very best way to upgrade is to use a visual comparison tool such as WinMerge, Meld, Kompare, BeyondCompare, and so on, to compare the newer version of the script against the one you are using. Using such a software, you can easily pinpoint which parts have been changed since you purchased the script and add those changes to yours while also keeping any possible modifications you have made.
Bear in mind, you need to know a little bit of PHP, HTML, CSS, in order to do an upgrade! If you do not, please either ask an expert or contact support at www.htmlpie.com/support
Get notified of updates
We provide free updates for all of our products :) If you would like to be informed of updates follow @htmlpie on twitter (@htmlpie) or subscribe our newsletter via www.htmlpie.com
1.4 How to enable SMTP
The Advanced version of the script supports SMTP; in order to enable it, open the configuration file, change the $configuration['MAILER'] value to swiftmailer_smtp, right below this are the SMTP connection settings, enter yours, save the configuration file and try the contact form once in order to make sure SMTP is working.
2. Requirements
- PHP 5.6 or higher with mail() funtion enabled.
- PHP GD graphics library (Only required for the mathematical CAPTCHA).
- Basic HTML\CSS knowledge.
4. Troubleshooting
Not receiving e-mail
Make sure you have entered a correct e-mail address in the contact-form/include/contact-form-configuration.php
Check your SPAM folder, sometimes emails arrive to that folder depending on the email address you've entered in the configuration file.
CAPTCHA not appearing
Make sure PHP GD library is installed on your Web server.
Whole page is blank
This often means there is a problem with some PHP code. On most shared hosting environments PHP errors are hidden by default for more security, you can contact your Web hosting provider or us :) in order to get help.
If none of the above helps, contact support at www.htmlpie.com/support