It all works except the confirmation page
When 12 is NOT used for the answer, it does not send an email but instead displays a bright whight page with the error message.
When 12 is used for the answer, it sends an email but displays a blank page (the URL is that of the PHP file)
So it appears we just need to fix the Confirmation page redirect.
I modified both codes a bit to include missing fields and for visual appearance. You can see the test page here: http://easydigging.com/Contact/contact_test.html
Here is the code:
HTML
<form id="edf" method="post" autocomplete="off" action="pullo.php" >
<fieldset>
<div class="form-actions" >
<legend> Contact Form </legend>
<label for="reporting">Message</label>
<textarea class="input-block-level" rows="3" name="reporting" id="reporting" maxlength="1000">
</textarea>
<span class="help-block">
If you would like us to reply to your message, please provide a good email or phone number.
</span>
<label for="person">Name</label>
<input class="input-block-level" type="text"
name="person" id="person" onkeypress="return event.keyCode != 13;">
<label for="onlineaddress">Email</label>
<input class="input-block-level" type="text"
name="onlineaddress" id="onlineaddress" onkeypress="return event.keyCode != 13;">
<label for="ringer">Phone Number</label>
<input class="input-block-level" type="text"
name="ringer" id="ringer" onkeypress="return event.keyCode != 13;">
<label for="country">Country <small class="muted"> If not USA, we can only email or text you.</small>
</label>
<input class="input-block-level" type="text"
name="country" id="country" onkeypress="return event.keyCode != 13;">
<div style=text-align:center;>
<label for="checker">
<strong>To prevent automated emails, you must answer this question:</strong><br />
What is 6 + 6 ?
</label>
<input class="input-mini" type="text" name="checker" id="checker" >
<p> </p>
<button class="btn btn-large btn-primary" type="submit"> Send Message </button>
<p> </p>
</div>
</div>
</fieldset>
</form>
PHP
<?php
$checker = $_POST['checker'];
if ($checker != 12){
echo "The automated email prevention question was wrong.<br />Please press the <b>BACK</b> button in your browser and try again.";
exit();
}
$url = "http://us.1.p10.webhosting.yahoo.com/forms?login=xxxxx";
$post_data = array (
"person" => $_POST['person'],
"onlineaddress" => $_POST['onlineaddress'],
"ringer" => $_POST['ringer'],
"country" => $_POST['country'],
"reporting" => $_POST['reporting']
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_exec($ch);
curl_close($ch);
//It's all good brother. POST data submitted, let's redirect!
header("http://easydigging.com/Contact/confirmcontact.html");
?>
I did experiment with the header at the end of the PHP file. I tried both ‘http…’ and “http…” neither worked and neither broke the program. I also tried appending &confirm=http… to the end of the email submittal URL (which is what my current simple form does) but that DID break the program (no emails, no confirmation page).
Any ideas on how to fix the Confirmation page thing?