Can someone look this over and help find out what is going on.
This is a simple form for a golf tournament. When I tried this yesterday, and uploaded it to my server, I could go through a very basic form, and send email from the server. The page would also redirect to the text at the bottom of the email.php page That is what I wanted.
I have added the last 3 parts of the form. card, number and expiry, and now the form doesn’t work. I had a few syntax errors, and figured the, out…missing letters, etc, and now I get no errors.
All I get is a a blank white screen. No errors, and no emails.
I really need to get this fixed up over the weekend…Please can some one help.
[code]<?php
if(isset($_POST[‘email’])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "xxx.xxxx.ca";
$email_subject = "New Golf registry";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['name']) ||
!isset($_POST['address']) ||
!isset($_POST['email']) ||
!isset($_POST['phone']) ||
!isset($_POST['homeClub']) ||
!isset($_POST['handicap']) ||
!isset($_POST['card']) ||
!isset($_POST['number']) ||
!isset($_POST['expiry']) ) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$name = $_POST['name']; // required
$address = $_POST['address']; // required
$phone = $_POST['phone']; // required
$email = $_POST['email']; // required
$homeClub = $_POST['homeClub']; // required
$handicap = $_POST['handicap']; // not required
$card = $_POST['card']; // required
$number = $_POST['number']; // required
$expiry = $_POST['expiry']; // required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$name_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($name_exp,$name)) {
$error_message .= 'The Name you entered does not appear to be valid.<br />';
}
$address_exp = '/^[A-Za-z0-9._%-]+$/';
if(!preg_match($address_exp,$address)) {
$error_message .= 'The address you entered does not appear to be valid.<br />';
}
$phone_exp = ‘/^[0-9._%.-]+$/’;
if(!preg_match($phone_exp,$phone)) {
$error_message .= 'The phone number you entered does not appear to be valid.<br />';
}
$homeClub_exp = '/^[A-Za-z0-9._%-]+$/';
if(!preg_match($homeClub_exp,$homeClub)) {
$error_message .= 'The Home Club you entered does not appear to be valid.<br />';
}
$handicap_exp = ‘/^[0-9-+]+$/’;
if(!preg_match($handicap_exp,$handicap)) {
$error_message .= 'The handicap you entered does not appear to be valid.<br />';
}
$card_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($card_exp,$card)) {
$error_message .= 'The Name you entered for your credit card does not appear to be valid.<br />';
}
$number_exp = "/^[0-9 .'-]+$/";
if(!preg_match($number_exp,$number)) {
$error_message .= 'The Credit Card information you entered does not appear to be valid.<br />';
}
$expiry_exp = "/^[A-Za-z0-9 .'-]+$/";
if(!preg_match($expiry_exp,$expiry)) {
$error_message .= 'The Expiry Date on your credit card that you entered does not appear to be valid.<br />';
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Name : ".clean_string($name)."\n";
$email_message .= "Address: ".clean_string($address)."\n";
$email_message .= "Email: ".clean_string($email). "\n";
$email_message .= "Number: ".clean_string($phone)."\n";
$email_message .= "Home Club: ".clean_string($homeClub)."\n";
$email_message .= "Handicap: ".clean_string($handicap)."\n";
$email_message .= "Credit Card: ".clean_string($card)."\n";
$email_message .= "Number: ".clean_string($number)."\n";
$email_message .= "Expiry".clean_string($expiry)."\n";
// create email headers
$headers = 'From: '.$email."\r\n".
$headers .=“CC: Mail1 [email protected]”;
$headers .=", Mail2 [email protected]";
'Reply-To: '.$email."\r\n" .
‘X-Mailer: PHP/’ . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
Thank you for contacting us. Your registation and payment has been processed, and we will be in touch with you very soon.
<?php } ?>[/code]
And here is the for from the html page:
[code]<form action=“email.php” method=“post”
Golf Registration
Name:
Address:
Phone:
E-mail:
Home Club:
<input type=“text” align=“right"name=“Home Club " value=”” size=“40”>Handicap:
REGISTRATION FEE PAYMENT OF $150 MUST BE MADE ONLINE IF USING THIS ENTRY FORM.
EXTRA DINNER TICKETS $50.00 EACH x =
I would like to make an additional donation to the Foundation: $<input type=“text” Name=“Additional Donation " + “&nspb” value=”"size=“20”>
PREFERRED SHOTGUN START:(PLEASE CHECK ONE)
8AM OR 1PM
Online Payment Information
Name(As it appears on your card):
Number:
Expiry:
Your payment will be processed by hand until further notice.
To ensure REGISTRATION, please submit before August 23, 2014 For more information: xxx.xxx.xxxx
Any help is greatly appreciated.