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 = "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 sec

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

 

function myRedirect() {

 

window.location = "contact.html";

}

//-->

</script>

[Code]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.