Jump to content

Form Errors


wright67uk

Recommended Posts

 

Im trying to get this form to work, however the email I receive after the form is submitted contains none of the users input. Can anyone see a reason for this?

 

 

 

<?php

if(isset($_POST['name'])) {

 

$to = "[email protected]"; // Your email

$subject = "you have received a new mobile website message"; // Subject

 

$name_field = $_POST['name'];

$email_field = $_POST['email'];

$message = $_POST['message'];

 

$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";

$headers = "From:" . $name_field;

 

if(@mail($to, $subject, $body, $headers)) echo "<h1>Thank you for your message!</h1>";

else echo "<h1>Email has been not sent!</h1>";

 

} else {

 

header('Location: contact.html');

 

}

?>

 

<script>

<!--

timeout = '2000'; // milliseconds/1000th of a sec

window.onload = setTimeout(myRedirect, timeout); // ensure we load the whole page

 

function myRedirect() {

 

window.location = "contact.html";

}

//-->

</script>

[Code]

Link to comment
https://forums.phpfreaks.com/topic/270274-form-errors/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.