Advertisement
  1. Code
  2. PHP
  3. PHP Scripts

Create a PHP Contact Form With ContactMe

Scroll to top

Today, we’re going to review the ContactMe tool, which allows you to create contact forms on your PHP site. It’s a very easy-to-use tool and allows you to set up different kinds of contact forms for any requirements.

As a site owner, you might like to have feedback from your users and customers about your services—that helps you to serve them better. Thus, a contact form on your website is a must-have feature to collect feedback from your users.

There are plenty of extensions and scripts available for creating contact forms on your PHP website. And of course, you’ll also find commercial options that provide ready-to-use features and extended support. In the case of commercial options, you can also expect quality code, bug fixes, and new enhancements.

In this post, we’re going to discuss the ContactMe tool, available at CodeCanyon for purchase at a very reasonable price. It provides a variety of contact forms and themes out of the box, and as the script supports customization, you could create your own combination of forms as well.

Let’s quickly go through the important features it provides:

  • ready-to-use forms in 28 combinations
  • built-in examples
  • support for themes
  • responsive and mobile-friendly
  • no database needed
  • SMTP support to send emails
  • spam protection
  • customizability
  • and much more

The ContactMe tool provides a lot of useful features which allow you to set up contact forms quickly. Throughout the course of this tutorial, we’ll explore the different features provided by this script.

To start with, we’ll see how to download and install the ContactMe script from the CodeCanyon marketplace.

Installation and Configuration

In this section, we’ll see how to install and configure the ContactMe tool once you’ve purchased and downloaded it from CodeCanyon.

As soon as you purchase it, you’ll be able to download the zip file. Extract it, and you will find the directory with the main script code: contactme. Copy this directory to your PHP application. For example, if your project is configured at /web/demo-app/public_html, you should copy the contactme directory to /web/demo-app/public_html/contactme.

The contactme directory contains the PHP code which handles the form validation and submission. Of course, it also sends an email containing the supplied information to the email address which is configured with the application.

On the PHP side, you need to configure a few settings. Go ahead and open the contactme/configs.php file. There are three settings that you need to configure in that file, as shown in the following snippet.

1
$configs['from_name'] = 'My Demo Site';
2
$configs['from_address']  = 'noreply@mydemosite.com';
3
$configs['to_addresses'] = array('info@mydemosite.com');

The from_name and from_address configuration values indicate the source of the email. The to_addresses configuration value is used to specify the email address which receives all the form submissions.

In the next section, we’ll discuss how to set up the necessary HTML code with the help of the ContactMe script to display a contact form on your site.

How to Set Up the Contact Us Form

When you extract the ContactMe zip file, you’ll find an index.html file which contains everything you need to get started setting up your contact form. In fact, it contains the HTML code for all the different types of contact forms supported by the script, along with all the different themes. So you could handpick the code of the form which you would like to use in your application.

In the following example, we’ll set up the General form with the modern theme. If you want to display a form other than the General form, you just need to copy the HTML code of that specific form instead.

Copy HTML Code

From the contactme/index.html file, copy the code between the <!-- START copy section: General Contact Form --> and <!-- END copy section: General Contact Form --> comments and paste it in your HTML page in the <body> section.

In our case, we want to use the modern theme instead of the default theme, so we just need to change the <form> tag class from contactMe small to contactMe small theme-modern.

Copy the JavaScript and CSS Code

Next, copy the CSS code between the <!-- START css copy section --> and <!-- END css copy section --> comments and put it in the <head> section. Similarly, copy the JavaScript code between the <!-- START js copy section --> and <!-- END js copy section --> comments and put it just before the </body> section in your HTML page.

And with that, we’re almost done! Let’s see how it looks:

Contact Us Form DemoContact Us Form DemoContact Us Form Demo

As you can see, it displays a nice, complete contact form which is ready to use! With form validation support out of the box, you don’t need to worry about spam submissions. Go ahead and fill in the form and submit it. If everything is configured properly, you’ll receive an email containing all the information.

In the next section, we’ll explore the different customization options supported by the ContactMe tool.

Customization Options

In the previous section, we discussed how to set up a basic contact form with the help of the ContactMe script. In this section, we’ll discuss a couple of important customization options supported by this script.

reCAPTCHA Support

The ContactMe tool supports the Google reCAPTCHA solution out of the box to prevent spam submissions. You can choose from two different versions: reCAPTCHA V2 or Invisible reCAPTCHA.

Multilingual Support

There are five different languages you could choose from for your contact form. At the moment, it supports English, Spanish, German, Italian, and Russian.

Theme Support

As we discussed earlier, the ContactMe Script provides different themes you can choose from to change the look and feel of your contact form. At the moment, it supports four different themes: Default, Modern, London, and Minimal.

Email Customization

When a user fills out and submits the contact form, the script sends two emails: the first one goes to the site owner, and the other goes to the user for confirmation. You can alter the email templates that are used to send emails to the site owner and user.

Custom Contact Forms

Although the ContactMe script provides several contact us form templates for you to choose from, sometimes you will need to add extra fields to the contact us form. And this is easily achieved by editing the form-specific PHP file.

So as you can see, the ContactMe tool offers a lot more than just a simple contact form. With the built-in forms and theme support, you could create a contact form of your choice for your website.

And with that, we’ve reached the end of this article!

The Next Step: Other Contact Us Form Scripts

If you're looking for more advanced contact us scripts that you could use right away, I recommend that you check out the following posts, which summarize some excellent scripts that are available for a low cost.

Conclusion

Today, we reviewed the ContactMe tool available at CodeCanyon. The sole purpose of this script is to allow you to create different types of contact us forms on your PHP website.

I hope that you’re convinced that the ContactMe tool is useful enough to fulfill your requirements. Although it’s a commercial plugin, I believe it’s reasonably priced considering the plethora of features it provides.

If you have any suggestions or comments, feel free to use the feed below and I’ll be happy to engage in a conversation!

Advertisement
Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.