form works on one site not others
Posted: Mon Jul 04, 2016 9:12 am
Hi all, firstly I am pretty new to php but there is something I really don't understand.
I have a standard php form that works perfectly well on my website and returns all form data including the usual name, number and a drop down and sends email within seconds, the problem I am having is I basically copy and paste the same form on to 2 other site and it returns to a thank you url but does not send the email at all, on another it pings back the error message and does not return to the thank you url. All 4 forms are exactly the same I just change the <option> tag and obviously the css links that is all that changes, I use Microsofts Expression 4 to build these sites.
and the anti spam is;
I have a standard php form that works perfectly well on my website and returns all form data including the usual name, number and a drop down and sends email within seconds, the problem I am having is I basically copy and paste the same form on to 2 other site and it returns to a thank you url but does not send the email at all, on another it pings back the error message and does not return to the thank you url. All 4 forms are exactly the same I just change the <option> tag and obviously the css links that is all that changes, I use Microsofts Expression 4 to build these sites.
Code: Select all
<?php
$name = $_POST['name'];
$number = $_POST['number'];
$email = $_POST['email'];
$type = $_POST['type'];
$message = $_POST['message'];
$from = 'From: Your Web Site';
$to = 'chris@cjwadsworth.co.za';
$subject = 'Website Enquiry';
$human = $_POST['human'];
$body = "From: $name\n Phone Number: $number\n E-Mail: $email\n type: $type\n Message:\n $message";
if ($_POST['submit'] && $human == '4') {
if (mail ($to, $subject, $body, $from)) {
header('Location: thankyou.php');
exit;
} else {
echo '<p>Something went wrong, go back and try again!</p>';
}
} else if ($_POST['submit'] && $human != '4') {
echo '<p>You answered the anti-spam question incorrectly!</p>';
}
?>Code: Select all
<label class="la">*What is 2+2? (Anti-spam)</label>