I am a complete novice before we start!
I have had a contact form created for me using PHP. I have embedded the code into my emailer html and changed the email address in the php file.
The people who created it say it works fine on their server and have sent me the emails to prove it does.
After clicking Submit, the email comes through but it is blank, any ideas?
PHP Code (file name simple-mailprocess_v2
):
<?
$to= ('info@cre8ivo.co.uk');
$subjectline= ('Website - form enquiry - Speak to a private medical insurance specialist');
$thanks=('thankyou.html');
$return=('Location:'.$thanks);
if (sizeof($_POST)) {
$body = "";
while(list($key, $val) = each($HTTP_POST_VARS)) {
$body .= "$key: \n $val \n\n";
// Check if all fields have been filled in
if(empty($val)) {
echo ("<b><li>either one or more required fields have not been completed. Go <a href='javascript: history.go(-1)'>Back</a> and try again</li></b>");
exit();
}
}
}
// Secure the headers
$security = "From: \r\n";
$security .= "Reply-To: \r\n";
$security .= "Return-Path: \r\n";
$security .= "CC: \r\n";
$security .= "BCC: \r\n";
// Send the email.
if ( mail($to,$subjectline,$body,$security) ) {
header($return);
} else {
echo "The email has failed!";
}
?>
Any help is much appreciated!
Any more info need then I will provide, not sure what it needed sorry!
Many Thanks, Jane.
Try changing $HTTP_POST_VARS to $_POST..
$HTTP_POST_VARS [deprecated] -> from php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.