Forum Moderators: coopster

Message Too Old, No Replies

form to email sends blank emails

php error, but where?

         

volvomad

12:25 am on Feb 23, 2007 (gmt 0)

10+ Year Member



Hi! I modified a php script to add more fields, but now only the email headers are getting through. The rest of the email is blank ($messageproper). I've pasted the code below, can anyone see where the fault is?

<?

$mailto = 'test@example.co.uk' ;
$subject = "Customer Product Registration" ;
$formurl = "http://www.example.com/registration/index.html" ;
$errorurl = "http://www.example.com/registration/error.html" ;
$thankyouurl = "http://www.example.com/registration/thanks.html" ;

$uself = 0;

$headersep = (!isset( $uself ) ¦¦ ($uself = 0))? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$address = $_POST['address'] ;
$zip = $_POST['zip'] ;
$country = $_POST['country'] ;
$phone = $_POST['phone'] ;
$email = $_POST['email'] ;
$date = $_POST['date'] ;
$agent = $_POST['agent'] ;
$module = $_POST['module'] ;
$charger = $_POST['charger'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) ¦¦ empty($address) ¦¦ empty($zip) ¦¦ empty($country) ¦¦ empty($email) ¦¦ empty($date)) {
header( "Location: $errorurl" );
exit ;
}
if ( ereg( "[\r\n]", $name ) ¦¦ ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit ;
}

if (get_magic_quotes_gpc()) {
$address = stripslashes( $address );
}

$messageproper =

"Registration from:\n" .
" NAME: " .
$name .
"\n Address: " .
$address .
"\n Zip/Post Code: " .
$zip .
"\n COUNTRY: " .
$country .
"\n Telephone: " .
$phone .
"\n Email: " .
$email .
"\n Date of purchase: " .
$date .
"\n Agent: " .
$agent .
"\n Module serial No: " .
$module .
"\n Charger serial No: " .
$charger .

mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
header( "Location: $thankyouurl" );
exit ;

?>

[edited by: coopster at 3:57 am (utc) on Feb. 23, 2007]
[edit reason] generalized domain [/edit]

supermanjnk

12:34 am on Feb 23, 2007 (gmt 0)

10+ Year Member




$messageproper =

"Registration from:\n" .
" NAME: " .
$name .
"\n Address: " .
$address .
"\n Zip/Post Code: " .
$zip .
"\n COUNTRY: " .
$country .
"\n Telephone: " .
$phone .
"\n Email: " .
$email .
"\n Date of purchase: " .
$date .
"\n Agent: " .
$agent .
"\n Module serial No: " .
$module .
"\n Charger serial No: " .
$charger .

mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
header( "Location: $thankyouurl" );
exit ;

Your $messageproper variable I assume should end at $charger

However you have a . there so it's trying to add the mail function to it, try instead of $charger . , $charger; whats happening is that it then trys to mail at this point, and since you haven't finished $messageproper (it's not set yet) it's showing up as blank

volvomad

8:45 am on Feb 23, 2007 (gmt 0)

10+ Year Member



The simple things... Thank you very much! I think I need to read more php instructions.