Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Submitting a form

Status
Not open for further replies.

dthomas31uk

Technical User
Oct 19, 2003
107
GB
Hi Guys. Have a form


Dont worry to much about look of it yet...just want to get it to submit correctly.

When I submit the form I recieve an email, but I only recieve the actual information from the message box.

I receive no name from the 'name' textbox.

From shows the actual server that my site is on '$to@customersites3.easily.co.uk

To shows the email address which its sent to ...which is correct.

What am I doing wrong?

Here is my phpfile

<?
$name = $_POST["name"];
$telephone = $_POST["telephone"];
$email = $_POST["email"];
$message = $_POST["message"];

$to = "myemail@adrress.co.uk"; // To email address
$subject = "Form submitted";
$headers = 'From: $to'. "\r\n" .
'Reply-To: $to' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

if(mail($to, $subject, $message, $headers))
{
header("Location: questions4.php");
exit;
}
else
{
echo "error in mail";
}

Hope someone can help. Cheers guys
 
that is because you are only sending the $message.

Code:
$message = $_POST["message"];

perhaps it would be better to do this:
Code:
$date = date ("j m Y hh:mm", strtotime("now"));
$message = $_POST["message"];
$message = <<<EOF
Enquiry from $name \r\n
Email address: $email\r\n
Made on $date\r\n
who left the following message: \r\n
$message

EOF;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top