A PHP/Ajax Contact form processor for your website
I created this project to provide an easily customizable PHP form processor with AJAX support. This project can be used as a general form processor with email-sending capability. It was originally intended for frontend developers who want a simple php form processor for their websites.
- Sends form content using AJAX (No reloading)
- Nicely display output of form processor
- It can be configured to handle multiple forms
- Can be used to process any kind of form and sends form content as email
Anti-spam support: comming soon- Depends on jquery
- Use this download link
- Unzip the content into your project directory
git clone https://github.com/dekyfin-academy/contact-form-php
<link rel="stylesheet" type="text/css" href="path/to/css/form.css" >
<script src="path/to/js/jquery.js" defer async></script>
<script src="path/to/js/form.js" defer async></script>
Note:
- the javascript file must be included after jquery
- For best performance add script just before
</body>
(closing body tag)
- Duplicate
php/config.sample.php
tophp/contact.php
. - Configure
php/contact.php
as desired. Comments are provided in the file to guide you with the configuration - It is recommended to create different configurations for different forms
- Add
form-processor
class to your form - Ensure the form's
action
attribute points to the the configuration file - [optional] Add an element with class
form-output
to the form to display the output of the form processor
<form class="form-processor" action="/path/to/contact.php">
<output class="form-output"></output>
<input name="name" type="text" placeholder="Your name" required />
<input name="email" type="email" placeholder="Email Address" required />
<textarea name="message" placeholder="Message"></textarea>
</form>