I used a free form generator as the template for a info request form on my site. After modifying it, I put I put it on the appropriate page, and uploaded the php mailer. It works as far as sending all the submitted info to the designated email, but I can’t get it to redirect to a disired page after successful submission. It remains on the same page, leaving the user to wonder if they should click submit again. I’ve googled the problem and tried using a “header” line to accomplish this, but no luck. Here’s the code for the mailer:
[php]<?php
// get posted data into local variables
$EmailFrom = "[email protected]";
$EmailTo = "[email protected]";
$Subject = “Inquiry from OCS website”;
$name = Trim(stripslashes($_POST[‘name’]));
$email = Trim(stripslashes($_POST[‘email’]));
$phone = Trim(stripslashes($_POST[‘phone’]));
$company = Trim(stripslashes($_POST[‘company’]));
$address = Trim(stripslashes($_POST[‘address’]));
$city = Trim(stripslashes($_POST[‘city’]));
$state = Trim(stripslashes($_POST[‘state’]));
$zipcode = Trim(stripslashes($_POST[‘zipcode’]));
$eventdate = Trim(stripslashes($_POST[‘eventdate’]));
$eventtime = Trim(stripslashes($_POST[‘eventtime’]));
$themeoroccasion = Trim(stripslashes($_POST[‘themeoroccasion’]));
$showlocation = Trim(stripslashes($_POST[‘showlocation’]));
$noofguest = Trim(stripslashes($_POST[‘noofguest’]));
$budget = Trim(stripslashes($_POST[‘budget’]));
$hearaboutocs = Trim(stripslashes($_POST[‘hearaboutocs’]));
$message = Trim(stripslashes($_POST[‘message’]));
// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
print “<meta http-equiv=“refresh” content=“0;URL=error.htm”>”;
exit;
}
// prepare email body text
$Body = “”;
$Body .= “***************************************************************”;
$Body .= “\n”;
$Body .= “*** You have received an inquiry from the OCS website ***”;
$Body .= “\n”;
$Body .= “***************************************************************”;
$Body .= “\n”;
$Body .= "Name: ";
$Body .= $name;
$Body .= “\n”;
$Body .= "Email: ";
$Body .= $email;
$Body .= “\n”;
$Body .= "Phone: ";
$Body .= $phone;
$Body .= “\n”;
$Body .= "Company: ";
$Body .= $company;
$Body .= “\n”;
$Body .= "Address: ";
$Body .= $address;
$Body .= “\n”;
$Body .= "City: ";
$Body .= $city;
$Body .= “\n”;
$Body .= "State: ";
$Body .= $state;
$Body .= “\n”;
$Body .= "Zipcode: ";
$Body .= $zipcode;
$Body .= “\n”;
$Body .= "Event Date: ";
$Body .= $eventdate;
$Body .= “\n”;
$Body .= "Event Time: ";
$Body .= $eventtime;
$Body .= “\n”;
$Body .= "Theme or Occasion: ";
$Body .= $themeoroccasion;
$Body .= “\n”;
$Body .= "Show Location: ";
$Body .= $showlocation;
$Body .= “\n”;
$Body .= "Approx Number of Guests: ";
$Body .= $noofguest;
$Body .= “\n”;
$Body .= "Budget: ";
$Body .= $budget;
$Body .= “\n”;
$Body .= "How did you Hear about OCS: ";
$Body .= $hearaboutocs;
$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.MY-DESIRED-REDIRECT-PAGE.com”>”;
}
else{
print “<meta http-equiv=“refresh” content=“0;URL=error.htm”>”;
}
?>[/php]
Any help would be appreciated!