Contact form for ProcessWire

A contact form for ProcessWire, just like here, by using only one template file with some lines of PHP. This template is also included in my site profile which I offer here.

Download the files
The download is available at the end of this page.

Set your parameter
Extract all files. Open simple-contact-form.php with a text editor. Enter your recaptcha site key and secret key if you want to use Google's recaptcha or leave it blank. You also have to specify the receiver email address in line 6.

Upload the files
Upload the PHP-file into site/templates/. Upload the CSS-file into site/templates/styles/ or in another directory you prefer for CSS-files. Please remember, that you have to link this CSS-file in your markup (_main.php) by yourself.

Install the templates
Go to Setup->Templates and click "Add New".

Add New Now you will see the simple-contact-form template file which you just uploaded into site/templates/. Set the checkmark on this file and click on "Duplicate fields used by another template". In the list below choose "home". Now click on "Add Template".

Add Template

Create the Contact Form Page
Go to the "Pages". Moving the cursor over the page name (e.g. "Home") will bring up some options. Click on "New".

New Select as template "simple-contact-form", enter a title e.g.: "Contact Form" and click "Save". On the next page click "Publish".

Click: Save Now you can link this "contact-form" in your navigation and call it.

Donate

Download:

Change log:

  • Version 1: Initial version
  • Version 2: Some improvements
  • Version 3: Send emails with WireMail instead of PHP mail function
Published: 29. Jan 2020
Categories: ProcessWire CMS PHP