if ($_POST['submit'] == TRUE) {
//print_r($_POST);
$punch = $_POST['punch-count'];
$crunch = $_POST['crunch-count'];
$i = $crunch+$punch;
switch ($i) {
case 0:
$total = '$-';
break;
case 1:
$total = '$75';
break;
case 2:
$total = '$125';
break;
default:
$total = '$'.($i*50);
}
$receiverMail = 'jannavanhasselt@gmail.com';
$email = $_POST['email'];
$subject = 'Punch Crunch Order';
$name = $_POST['name'];
$address = $_POST['address'];
$msg = "Name: $name
Email: $email
Address: $address
Order Punch: $punch
Crunch: $crunch
$total to pay by: ".$_POST['pay'];
$subject2 = 'Thank you for your Punch Crunch order, PayPal instructions enclosed';
$msg2 = "Thank you so much for your order! Here's the details of what I'll be sending you:
";
if($punch>0){$msg2 .=" Punch X $punch
";}
if($crunch>0){$msg2 .=" Crunch X $crunch
";}
$msg2 .="$total to pay by: PayPal
PayPal detailsPlease send payment of $total to printmaker@janna.co.nz";
if(empty($receiverMail)) {
print "
Order incomplete. Please fill in a valid email address
";
}elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $receiverMail)) {
print "
Order incomplete. Please fill in a valid email address
";
}elseif(mail($receiverMail, $subject, $msg, 'MIME-Version: 1.0' . "\r\n".'Content-type: text/html; charset=iso-8859-1' . "\r\n"."From: $name <$email>")) {
print"
Order Completed
";
if($_POST['pay'] == 'Paypal'){
mail($email, $subject2, $msg2, 'MIME-Version: 1.0' . "\r\n".'Content-type: text/html; charset=iso-8859-1' . "\r\n"."From: Janna van Hasselt
");
print"Please check your email for details of my PayPal account
";
}
}else{
print "The order was not completed. Please try again... If the problem continues try emailng me at printmaker@janna.co.nz
";
}
} ?>