Page 1 of 1

undefined variable query

Posted: Wed Mar 29, 2006 3:13 am
by Addos
Hi, I keep getting the error ‘undefined variable’ which is referring to $to from this bit of code below when I try to submit my page.
Can anyone tell me what is wrong as I have used this on other pages on other sites and don’t get this error?
Any help would be great
Thanks
Brian

Code: Select all

$from = 'Snazzy Dogz' . "\r\n";
	$subject = 'Message from your Web Site ' . "\r\n";
	$headers = "To: Snazzy Dogz <info@blah.com>, Admin<info@blah.com> \r\n";
	$headers .= "from: $from\n";
	$message =  $_POST['Name']. ' is requesting some information from you.' . "\r\n";
	$message .=  ' ' . "\r\n";
	$message .= 'The Subject is: ' .$_POST['Subject']. "\r\n";
    $message .=  ' ' . "\r\n";
	$message .= 'They wrote: ' ."$messagedetails". "\r\n";
	$message .=  '' . "\r\n";
	$message .= 'You can email them back at: ' .$_POST['Email']. "\r\n";
	$message .=  ' ' . "\r\n";
	$message .=  ' ' . "\r\n";
	$message .=  ' ' . "\r\n";
	$message .= 'This email has been automatically generated. Please do not reply to it.' . "\r\n";
  mail($to,$subject,$message,$headers);
  header('Location: contact_act.php');
  exit();

Posted: Wed Mar 29, 2006 3:15 am
by onion2k
$to isn't set in that code.. hence it's being reported as undefined.