Feedback Form With PHP And jQuery

feedback form in php
File Size:73.06 KB
Views Total:1,255
Last Update:January 5, 2018
Publish Date:January 5, 2018
Official Website:Go to website

In this tutorial we are making a simple feeback form with php and jquery. it work with jQuery, PHP and the PHPMailer class, this form sends the users’ suggestions directly to admin mailbox. you can easily customize with code as your requirement. Lets start with the HTML Code with the style sheet is included in the top of the document, and the JavaScript source files in the end of bottom page. This improves the perceived performance of the page, as the scripts are loaded last, thus allowing for the design of the site to be displayed.

How to use :

1. Add Html code :

<div id="feedback">

    <!-- Five color spans, floated to the left of each other -->

    <span class="color color-1"></span>
    <span class="color color-2"></span>
    <span class="color color-3"></span>
    <span class="color color-4"></span>
    <span class="color color-5"></span>

    <div class="section">

        <!-- The arrow span is floated to the right -->
        <h6><span class="arrow up"></span>Feedback</h6>

        <p class="message">Please include your contact information if you'd like to receive a reply.</p>


        <a class="submit" href="">Submit</a>

2. Add source file CSS/JS Script :

<link rel="stylesheet" type="text/css" href="styles.css" />

<script src=""></script>
<script src="script.js"></script>

3. Add PHP file submit.php for sends an email message to your email address :

// Enter your email address below
$emailAddress = '[email protected]';

// Using session to prevent flooding:


// If the last form submit was less than 10 seconds ago,
// or the user has already sent 10 messages in the last hour

if( $_SESSION['lastSubmit'] && ( time() - $_SESSION['lastSubmit'] < 10 || $_SESSION['submitsLastHour'][date('d-m-Y-H')] > 10 )){
    die('Please wait for a few minutes before sending again.');

$_SESSION['lastSubmit'] = time();

require "phpmailer/class.phpmailer.php";

    // If magic quotes are enabled, strip them
    $_POST['message'] = stripslashes($_POST['message']);

if(mb_strlen($_POST['message'],'utf-8') < 5){
    die('Your feedback body is too short.');

$msg = nl2br(strip_tags($_POST['message']));

// Using the PHPMailer class

$mail = new PHPMailer();

// Adding the receiving email address

$mail->Subject = 'New Quick Feedback Form Submission';

$mail->AddReplyTo('[email protected]'.$_SERVER['HTTP_HOST'], 'Quick Feedback Form');
$mail->SetFrom('[email protected]'.$_SERVER['HTTP_HOST'], 'Quick Feedback Form');


echo 'Thank you!';

Done ūüôā