wright67uk Posted November 4, 2012 Share Posted November 4, 2012 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? <?phpif(isset($_POST['name'])) { $to = "myemail@hotmail.co.uk"; // 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 secwindow.onload = setTimeout(myRedirect, timeout); // ensure we load the whole page function myRedirect() { window.location = "contact.html";}//--></script> [Code] Quote Link to comment https://forums.phpfreaks.com/topic/270274-form-errors/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.