Greetings to my readers, I have gained experience and I will tell you about the principles of the php feedback form. I'll show you with illustrative examples so that you understand how everything works and how the interaction between the input form itself (its input fields) and the handler file written in php takes place. In addition, you can download the sources for free along with.

Of course, it will be great if you know a little about HTML / CSS. By analogy, you will have to drag the code onto your page. We will not touch on the PHP language, I will show all the necessary edits that need to be done for myself.

UPDATE: According to the responses of readers, I realized that you need something more beautiful and functional, meet, read and see. Choose which one you like best)

UPDATE2: Version 3.0 Responsive Landing Page + ajax form with passing UTM tags, read and see. You'll like it

I remembered myself when I first tried to make my own feedback form in php, and to be honest, it was laborious, because did not understand what was happening and how. Patience and perseverance are friends and you will succeed.

Php contact form - structure

We will study the analysis of the feedback form itself on the example of a landing page (Landing Page), by the way, there is a separate article on. You can see how it works in action using the buttons below, I attach the sources of this one-page page and the main file of the php handler (this file will process and send a letter to email)

After downloading the sources and unpacking the archive, you will see the following file structure:

  • image - all images that are used for the Landing Page itself, buttons, etc.
  • js - javascript scripts that provide, for example, a popup modal on the page and other visual effects
  • index.html - our one page index file
  • index1.php - a handler file into which values ​​from the form are passed, then a letter is formed from the received variables and sent to the specified email address. Also, index1.php will act as an intermediate page for notification of successful data submission with automatic redirection back to index.html (i.e. our one-page page)

It is important that your hosting, on which the site files are located, supports php processing, otherwise the index1.php file will not be executed and will not work. To clarify this nuance, contact the campaign where your hosting is registered or just test it - it works, which means there is support. If not, enable php language support option

Take a look at how the interaction of all elements (page, form, handler) works

The source code of the form call and handler

Let's take a look at the operation of one of the buttons, which invokes a modal pop-up window that contains a feedback form. This given source code is more than once, two inserted into the page and it will work, you yourself will have to customize it to your design and needs.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Request a call back

Request a call back

Below is the full source code of the index1.php handler, in order to configure sending to your mailbox, change “ [email protected]»On your own, the rest, in principle, can be left unchanged

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 "; // from whom $ send = mail ($ address, $ sub, $ mes," Content-type: text / plain; charset = utf-8 \ r \ nFrom: $ email "); ini_set (" short_open_tag ", "On"); header ("Refresh: 3; URL = index.html");?> You will be contacted