How do I make a contact form?

A contact form is easy to create and integrate into an existing website. Whilst simple contact forms can be very beneficial for most websites. They enable simple communication between yourself and any visitors to your site.

They’re also a lot easier than having to call up and wait for a representative of the site. If you’re really clued-up, you could also integrate OCR & Machine learning software to make sure important contacts take priority.

Contact forms for WordPress

There are a few ways to take advantage of a contact form. If you’re currently using WordPress, there are different plugins available. This is the easiest option as you will only need to consider a configuration with no need for PHP, or SQL knowledge. And you’ll never have to worry about updates! 

Contact forms in PHP 

PHP usage is common across the Internet. The nature of PHP makes it both easy to use & deploy on existing websites. Similar to JavaScript, PHP can be embedded into existing HTML, adding a host of extended features. Both PHP and JavaScript can be run server-side, retaining functionality whilst obscuring the original code from visitors reducing the potential to be reverse-engineered.

How can I create my own PHP contact form?

  1. A good starting point for your PHP form is this article

  2. To get this form to work with our hosting properly, you will need to set the “From” address in the code as below:

  3. Where the code says: 

  4. mail($to,$subject,$message,$headers);

  5. You need to add the from address in this format:

  6. mail($to,$subject,$message,$headers,"-f your@email.here");

  7. The address should be one that is configured on your server.

Notice: SPAM from unsecured contact forms

Contact forms can be a blessing. They’re a great tool for communicating with visitors to your site. Giving potential customers the opportunity to enquire before purchasing and allowing contact between businesses, enabling B2B sales.

However, contact forms have the potential to become a curse. Unsecured contact forms are one of the most common attack vectors we see at Unlimited. If left unsecured, a contact form can easily fall victim to attack, with spammers tricking your contact form to send out thousands of spam emails.

At Fastnet Hosting, we have robust spam detection systems. We monitor all outgoing traffic across our shared services to determine whether it is legitimate. Illegitimate traffic could cause a disproportionate amount of load across the shared server. Therefore, sending sites run the risk of suspension.

Luckily, preventative actions such as securing with a captcha are relatively simple to implement. A few captcha providers exist but to name a few examples: