Hi I purchased from DXThemes a kids template http://dev.artin2ition.com/24/
and I would like to add a text confirm and text error line on the contact form
something like Thank you for contacting us! or i a case of error
Due to an unknown error, your form was not submitted, please resubmit it or try later. I would like to add this after clicking on the send button, just simply beneath contact form exactly like on contactform 7
example : http://contactform7.com/contact/
At the moment when I send a message , after clicking the send button its just redirect me to the heather of the page and cleans up the contact form, without any notification.
Because I am the webmaster I can check the my mailbox and I can see that I received the message successfully , but the user can't.
I think this can be confusing for the user , the user cant be 100% sure the message was sent successfully or it is just some problem.
I have 2 php-s that are related to contact form
shortcodes.php
<form id="form-main-'.$suf.'" action="'.$baseurl.'/lib/mail.php" method="post" class="afl-cf">
<fieldset>
<div>
<input name="name" type="text" value="Your Name" onclick="if(this.value==\'Your Name\')this.value=\'\';" onblur="if(this.value==\'\')this.value=\'Your Name\';" class="input-name validate[required,custom[onlyLetterNumber],maxSize[20]]" id="name-'.$suf.'"/>
<input name="email" type="text" value="Your E-Mail" onclick="if(this.value==\'Your E-Mail\')this.value=\'\';" onblur="if(this.value==\'\')this.value=\'Your E-Mail\';" class="input-email validate[required,custom[email]]" id="mail-'.$suf.'"/>
<input name="subject" type="text" value="Subject" onclick="if(this.value==\'Subject\')this.value=\'\';" onblur="if(this.value==\'\')this.value=\'Subject\';" class="input-subject" id="web-'.$suf.'"/>
</div>
<textarea name="message" class="input-message validate[length[6,3000]]" id="mess-'.$suf.'" onclick="if(this.value==\'Message\')this.value=\'\';" onblur="if(this.value==\'\')this.value=\'Message\';">Message</textarea>
<p><a href="#" onClick="send(\'#form-main-'.$suf.'\')" class="form-link">Send</a></p>
</fieldset>
</form>
and mail.php
<?php
#YOUR E-MAIL
define('WP_USE_THEMES', false);
require('../../../../wp-load.php');
define('TO', get_option('admin_email'));
header('Content-Type: text/html; charset=utf-8');
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
##E-MAIL SUBJECT
define('SUBJECT', 'Contact Form!');
function sendEmail($to, $from, $subj, $body)
{
$date = date( 'r' );
$phpversion = phpversion();
$boundary = md5( time() );
$headers = "From: $from\n"."Date: $date\n"."Content-Type: text/html; charset=\"UTF-8\"\n";
mail(trim($to), trim($subj), $body, $headers );
}
sendEmail(TO, trim($_POST['email']), SUBJECT, 'E-Mail from: '.$_POST['name'].'<br/>'.'Subject: '.trim($_POST['subject']).'<br /><br/>Message: '.nl2br($_POST['message']));
}
?>
Thanks in advance