$date="";
$registrants="";
$name="";
$title="";
$company="";
$address="";
$city="";
$state="";
$postal_code="";
$phone="";
$fax="";
$email="";
$cardtype="";
$ammount="";
$cardname="";
$cardnumber="";
$cardexpdate="";
$cammount="";
if(isset($_POST['submit'])){
$to = "matt@whitfield.ca";
$from_header = "From: compnews@humanresourcesinfo.com";
$subject="Workshop Form Registration";
$contents="";
$errors="";
if(isset($_POST['date']) && trim($_POST['date'])!==""){
$date=$_POST['date']."\n";
}
else{ $errors.="Date must be set
\n"; }
if(isset($_POST['registrants']) && trim($_POST['registrants'])!==""){
$registrants=$_POST['registrants']."\n";
}
else{ $errors.="Registrants must be set
\n"; }
if(isset($_POST['name']) && trim($_POST['name'])!==""){
$name=$_POST['name']."\n";
}
else{ $errors.="Name must be set
\n"; }
if(isset($_POST['title']) && trim($_POST['title'])!==""){
$title=$_POST['title']."\n";
}
else{ $errors.="Title must be set
\n"; }
if(isset($_POST['company']) && trim($_POST['company'])!==""){
$company=$_POST['company']."\n";
}
else{ $errors.="Company must be set
\n"; }
if(isset($_POST['address']) && trim($_POST['address'])!==""){
$address=$_POST['address']."\n";
}
else{ $errors.="Address must be set
\n"; }
if(isset($_POST['city']) && trim($_POST['city'])!==""){
$city=$_POST['city']."\n";
}
else{ $errors.="City must be set
\n"; }
if(isset($_POST['state']) && trim($_POST['state'])!==""){
$state=$_POST['state']."\n";
}
else{ $errors.="State must be set
\n"; }
if(isset($_POST['postal_code']) && trim($_POST['postal_code'])!==""){
$postal_code=$_POST['postal_code']."\n";
}
else{ $errors.="Postal Code must be set
\n"; }
if(isset($_POST['phone']) && trim($_POST['phone'])!==""){
$phone=$_POST['phone']."\n";
}
else{ $errors.="Phone must be set
\n"; }
if(isset($_POST['fax']) && trim($_POST['fax'])!==""){
$fax=$_POST['fax']."\n";
}
else{ $errors.="Fax must be set
\n"; }
if(isset($_POST['email']) && trim($_POST['email'])!==""){
$email=$_POST['email']."\n";
}
else{ $errors.="E-mail must be set
\n"; }
if(isset($_POST['cardtype']) && trim($_POST['cardtype'])!==""){
$cardtype=$_POST['cardtype'];
}
else{ $errors.="Payment Type must be set
\n"; }
if($cardtype==="v" || $cardtype==="m"){
if(isset($_POST['ammount']) && trim($_POST['ammount'])!==""){
$ammount=$_POST['ammount']."\n";
}
else{ $errors.="Money ammount must be set
\n"; }
if(isset($_POST['cardname']) && trim($_POST['cardname'])!==""){
$cardname=$_POST['cardname']."\n";
}
else{ $errors.="Cardholder's Name be set
\n"; }
if(isset($_POST['cardnumber']) && trim($_POST['cardnumber'])!==""){
$cardnumber=$_POST['cardnumber']."\n";
}
else{ $errors.="Credit Card Number must be set
\n"; }
if(isset($_POST['cardexpdate']) && trim($_POST['cardexpdate'])!==""){
$cardexpdate=$_POST['cardexpdate']."\n";
}
else{ $errors.="Credit Card Expiration Date must be set
\n"; }
}
elseif($cardtype==="c"){
if(isset($_POST['cammount']) && trim($_POST['cammount'])!==""){
$cammount=$_POST['cammount']."\n";
}
else{ $errors.="Money ammount must be set
\n"; }
}
if($errors === "")
{
$contents="";
$contents.="DATE: ".$date."\n";
$contents.="NUMBER OF REGISTRANTS: ".$registrants."\n";
$contents.="NAME: ".$name."\n";
$contents.="TITLE: ".$title."\n";
$contents.="COMPANY: ".$company."\n";
$contents.="ADDRESS: ".$address."\n";
$contents.="CITY: ".$city."\n";
$contents.="STATE: ".$state."\n";
$contents.="POSTAL CODE: ".$postal_code."\n";
$contents.="PHONE: ".$phone."\n";
$contents.="FAX: ".$fax."\n";
$contents.="E-MAIL: ".$email."\n";
if($cardtype=="v"){
$contents.="PAYMENT METHOD: CREDIT CARD\n";
$contents.="CARD TYPE: VISA\n";
$contents.="AMMOUNT: ".$ammount."\n";
$contents.="CARDHOLDER'S NAME: ".$cardname."\n";
$contents.="CARD NUMBER: ".$cardnumber."\n";
$contents.="CARD EXPIRATION DATE: ".$cardexpdate."\n";
}
if($cardtype=="m"){
$contents.="PAYMENT METHOD: CREDIT CARD\n";
$contents.="CARD TYPE: MASTERCARD\n";
$contents.="AMMOUNT: ".$ammount."\n";
$contents.="CARDHOLDER'S NAME: ".$cardname."\n";
$contents.="CARD NUMBER: ".$cardnumber."\n";
$contents.="CARD EXPIRATION DATE: ".$cardexpdate."\n";
}
if($cardtype=="c"){
$contents.="PAYMENT METHOD: CHEQUE\n";
$contents.="AMMOUNT: ".$cammount."\n";
}
//send mail - $subject & $contents come from surfer input
mail($to, $subject, $contents, $from_header);
// redirect back to url visitor came from
//header("Location: $HTTP_REFERER");
}
}
?>
|
|||||||||||||||||||||||||||||||
|