PDA

View Full Version : Form wont submit !


spazzer
01-06-2011, 01:57 PM
Hi,
I am going to have one last stab at rectifying my form problem before starting from scratch again !, everything works fine whilst submitting form etc, recaptcha seems ok etc but for some reason the form isn't being sent !.
I think its something fairly straightforward but I can't see where I've gone wrong !, I have an alternative to try but was wondering if anyone can finally help if not I will try again from scratch.
My website is at nixwebdesign.co.uk if you need to take a look !!!

Thanks for any help provided !



This my mailer.php code


<?php
require_once('recaptchalib.php');
$privatekey = "6Lc1nb8SAAAAAKSJXqJyn-GbqmiHTMs2Odv3Y045";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if(!$resp->is_valid) {
header("location:contact.php");
die();
}
//these are the form results
$name = $_POST['name'];
$email = $_POST['email'];
$enquiry = $_POST['enquiry'];
$formsub = $_POST['Submit'];

if($formsub){

//this creates the body of the mail message
$mailMessage = "The message is: Hi Nik. You have a message from Nix Web Design";
$mailMessage .= "Name:" .$name."\n\n";
$mailMessage .= "E-Mail:" .$email."\n\n";
$mailMessage .= "Enquiry:" .$enquiry."\n\n";
$header = "From: nik@nixwebdesign.co.uk\r\n";
$header .= "Reply-To: nik@nixwebdesign.co.uk\r\n";
$header .= "Return-Path: nik@nixwebdesign.co.uk\r\n";
mail('nik@nixwebdesign.co.uk', 'Website Enquiry', $mailMessage,$header);

header("location:thanks.php");
exit;

}
?>

This is my html etc in contact.php


<form action="mailer.php" id="contact" method="post">

<p><label>Name</label>
<input name="name" type="text" size="30" id="name">

<label>E-mail</label>
<input name="email" type="text" size="30" id="email">

<label>Your Comments</label>
<textarea name="enquiry" cols="5" rows="5" id="enquiry">Please type your enquiry here.</textarea>

<br />
</p>
<!-- ReCaptcha HTML and Script Starts Here -->
<script type="text/javascript">
var RecaptchaOptions = {
theme: 'custom',
lang: 'en',
custom_theme_widget: 'recaptcha_widget'
};
</script>
<div id="recaptcha_widget" style="display:none"><div id="recaptcha_image"></div>
<div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect, please try again</div>
<span class="recaptcha_only_if_image">Enter the words above:</span>
<span class="recaptcha_only_if_audio">Type what you hear:</span>

<input type="text" id="recaptcha_response_field" name="recaptcha_response_field">
<div><a href="javascript:Recaptcha.reload()">Get another CAPTCHA</a></div>
<div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">Get an audio CAPTCHA</a></div>
<div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')">Get an image CAPTCHA</a></div>
<div><a href="javascript:Recaptcha.showhelp()">Help</a></div>
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=6LcPWr0SAAAAAM7QN9rjepjhuPJ-TL4BSjw4t8db"></script>
<noscript><iframe src="http://www.google.com/recaptcha/api/noscript?k=6LcPWr0SAAAAAM7QN9rjepjhuPJ-TL4BSjw4t8db" height="300" width="500" frameborder="0"></iframe><br>
<textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"></noscript></div>
<script type="text/javascript">
window.onload = function() {
Recaptcha.focus_response_field();
}
</script>


<table cellspacing="0" cellpadding="4" border="0" style="font-family: Helvetica, sans-serif; color: #000000; font-size: 12px;"><tr><td><div><input type="submit" name="Button1" value="Submit">
</div></td>
<td><b style="line-height: 18px;">The words above come from scanned books. <br> By typing them, you help to digitize old texts.</b></td></tr></table>
<!-- ReCaptcha HTML and Script Finishes Here -->

</form>

jmichae3
01-08-2011, 04:06 AM
just out of curiosity, why do you have mixed closed and unclosed singleton elements? if this is xhtml, unclosed elements will hork up your form.

I know nothing about recaptcha (I use something else).

jmichae3
01-08-2011, 04:09 AM
edbr was just saying about somebody else's mailer form that you probably need mx records to send.

spazzer
01-08-2011, 12:44 PM
Hi All,
Have used something else now and is working fine, thanks for comments all !

Cheers,
Nick C