The PHP version was upgraded on my server and now all the forms on the site are giving me errors. What changes need to be made to make it compatible to newest versions of PHP?
<?php
$EmailFrom = "email@email.com";
$EmailTo = "email@email";
$Subject = "Thanks for contacting us";
$YourName = Trim(stripslashes($_POST['YourName']));
$Company = Trim(stripslashes($_POST['Company']));
$Address = Trim(stripslashes($_POST['Address']));
$Address2 = Trim(stripslashes($_POST['Address2']));
$City = Trim(stripslashes($_POST['City']));
$State = Trim(stripslashes($_POST['State']));
$Zipcode = Trim(stripslashes($_POST['Zipcode']));
$Country = Trim(stripslashes($_POST['Country']));
$Phone = Trim(stripslashes($_POST['Phone']));
$YourEmail = Trim(stripslashes($_POST['YourEmail']));
$Product2 = Trim(stripslashes($_POST['Product2']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact-error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $YourName;
$Body .= "\n";
$Body .= "Company: ";
$Body .= $Company;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $Address;
$Body .= "\n";
$Body .= "Address 2: ";
$Body .= $Address2;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "State: ";
$Body .= $State;
$Body .= "\n";
$Body .= "Zip Code: ";
$Body .= $Zipcode;
$Body .= "\n";
$Body .= "Country: ";
$Body .= $Country;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $YourEmail;
$Body .= "\n";
$Body .= "Product: ";
$Body .= $Product2;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.website.com/contact-dealer-thanks.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://http://www.website.com/contact-dealer-thanks.html\">";
}
?>
<script language="php">$email = $HTTP_POST_VARS[email];
$mailto = "$YourEmail";
$mailsubj = "We received your request for dealer information";
$mailhead = "From: email@email.com";
reset ($HTTP_POST_VARS);
$mailbody = "$YourName,
Thanks for contacting us!
One of our sales representatives will be in touch in the next 24-48 hours with more information.
Regards,
Sales Team";
while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; }
if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); }
$storecontact=fopen("contactstoragetmp123.txt","a+");
fwrite($storecontact,$mailbody . "\r\n\r\n\r\n\r\n");
fclose($storecontact);
</script>
I tried to paste the code from the page here as well but it was too long.