I have a contact form on a Wordpress based website that is not working. It works on the theme creators site, and I have tried to contact them for help, but have not received a response.
If you can help I will be truly grateful.
THEME DEMO PAGE (it works here): http://vooshthemes.com/gallery/satoshi-v2/?page_id=14
Here is the code for the 2 files
JS file
$(function(){
$('#form_submit').click(function(){
var input_name = $('#form_name').val(),
input_email = $('#form_email').val(),
input_subject = $('#form_subject').val(),
input_message = $('#form_message').val(),
response_text = $('#response');
response_text.hide();
response_text.html('Loading...').show();
$.post('http://www.justicewebdesign.com/wp-content/themes/satoshi/scripts/contact-process.php', {name: input_name, email: input_email, subject: input_subject, message: input_message}, function(data){
response_text.html(data);
});
return false;
});
});
PHP file
<?php
if(isset($_POST['name']) && empty($_POST['spam_check']))
{
require 'email-validator.php';
$validator = new EmailAddressValidator();
$errors = array();
$input_name = strip_tags($_POST['name']);
$input_email = strip_tags($_POST['email']);
$input_subject = strip_tags($_POST['subject']);
$input_message = strip_tags($_POST['message']);
$required = array('Name field' => 'name', 'Email field' => 'email', 'Message field' => 'message');
foreach($required as $key=>$value)
{
if(isset($_POST[$value]) && $_POST[$value] !== '')
{
continue;
}
else {
$errors[] = $key . ' cannot be left blank';
}
}
if (!$validator->check_email_address($input_email)) {
$errors[] = 'Enter a valid email address.';
}
if(empty($errors))
{
if(mail('contact@justicewebdesign.com', "Message from $input_name - $input_subject", $input_message, "From: $input_email"))
{
echo 'Thank You - your email has been sent.';
}
else
{
echo 'There was an issue when sending your email. Please try again.';
}
}
else
{
echo implode('<br />', $errors);
}
}
else
{
die('You cannot access this page directly.');
}