How Contact Forms Work

We’re not going to discuss the actual code of the contact form in this tutorial, but it is important to understand how the form actually works and we want to cover that first.  If you missed our previous article, please see the Advantages of using a Contact Form tutorial.

When a visitor goes to your contact page on your website, they will need to fill out the form. Once they have filled out the form fields, they will click the button to submit. Once submitted, the information in the fields will automatically be sent via email to you. On the server-side, once the submit button is clicked, typically a Perl script or PHP file runs. This reads the request and sends it to your email address. Don’t worry if you do not have an in-depth understanding of PHP or Perl.

When you receive the email, all the questions your visitor filled in will be in the email. Each time you receive an email it will be in the same format. This simplifies reading the email and even organizing them. since every email will have the same subject line, you can sort the emails to filter into their own folder in your email account.

After the form is processed by the server, you then have the ability to control where the visitor is re-directed to. You can have them return to the contact page or even be redirected to a custom thank you page. Typically, you will want to redirect them to a different page where you can acknowledge you have received their request and will contact them shortly. Setting up a contact form takes longer than a simple mailto tag however the benefits we mentioned in the previous tutorial make it worth the extra time and effort.      

Please check the next article on Creating a Contact Form with FormMail.

2 thoughts on “How Contact Forms Work

  1. It would have been helpful if it were true. I have a mockup of a contact form on « /feedback.html » (the “long name” consolidates the name of the website listed in connexion with the letter and the filename in question), but I can’t find any sort of coding that will get it to work. Perhaps I’m missing something—perhaps a way to help the sender access their outgoing servers, whatever it may be—perhaps an appropriate server dialogue to send a report consolidating the sender’s fillin data—perhaps a way of configuring my own receiving server to receive the report—perhaps an Easter rabbit’s foot, a four-leaf clover and a namomyoho-rengekyo, whatever that is. Whatever advice or suggestions you can provide will be deeply appreciated

    1. Hi Stephen, I’m not sure if you were trying to paste a link to your site or just discussing its setup in general, but I’ll try to offer some tips.

      First, a question: are you creating this contact form using the FormMail tutorial this article was a part of once, by coding it yourself, or through another tool like WordPress? If coding it yourself, are you using something like this PHP contact form script, or a different method? If you’re using PHP, be sure to enable PHP error logs while you’re developing so you can know when and where something goes wrong. In the early stages you’ll likely need to check other error logs as well.

      I hope that helps, but please feel free to provide a bit more detail about what you’re working on and we’ll let you know what resources you may find helpful.

Was this article helpful? Join the conversation!