<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "
[email protected]";
$email_subject = "Davisburg Sports Registration";
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['players_first_name']) ||
!isset($_POST['players_last_name']) ||
!isset($_POST['players_birth']) ||
!isset($_POST['soccer']) ||
!isset($_POST['baseball']) ||
!isset($_POST['parentnames']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone']) ||
!isset($_POST['mother_cell']) ||
!isset($_POST['father_cell']) ||
!isset($_POST['t_shirt']) ||
!isset($_POST['volunteer']) ||
!isset($_POST['comments']) ||
!isset($_POST['waivername']) ||
!isset($_POST['waiveraddress']) ||
!isset($_POST['waiverphone']) ||
!isset($_POST['waiver']) ||
!isset($_POST['waiverdate'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$players_first_name = $_POST['players_first_name']; // not required
$players_last_name = $_POST['players_last_name']; // not required
$players_birth = $_POST['players_birth']; // not required
$parentnames = $_POST['parentnames']; // not required
$email_from = $_POST['email']; // required
$telephone = $_POST['telephone']; // not required
$mother_cell = $_POST['mother_cell']; // not required
$father_cell = $_POST['father_cell']; // not required
$comments = $_POST['comments']; // not required
$waivername = $_POST['waivername']; // not required
$waiveraddress = $_POST['waiveraddress']; // not required
$waiverphone = $_POST['waiverphone']; // not required
$waiver = $_POST['waiver']; // not required
$waiverdate = $_POST['waiverdate']; // not 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 .= 'Please fill in a valid email address.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$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 .= "Players First Name: ".clean_string($players_first_name)."\n";
$email_message .= "Players Last Name: ".clean_string($players_last_name)."\n";
$email_message .= "Players Birthdate: ".clean_string($players_birth)."\n";
$email_message .= "Soccer: ".clean_string($soccer)."\n";
$email_message .= "Baseball: ".clean_string($baseball)."\n";
$email_message .= "Parent's Names: ".clean_string($parentnames)."\n";
$email_message .= "Home Telephone: ".clean_string($telephone)."\n";
$email_message .= "Mother's Cell: ".clean_string($mother_cell)."\n";
$email_message .= "Fathers's Cell: ".clean_string($father_cell)."\n";
$email_message .= "T-Shirt:".clean_string($t_shirt)."\n";
$email_message .= "Volunteer: ".clean_string($volunteer)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";
$email_message .= "Waiver Name: ".clean_string($waivername)."\n";
$email_message .= "Waive Address: ".clean_string($waiveraddress)."\n";
$email_message .= "Waiver Phone: ".clean_string($waiverphone)."\n";
$email_message .= "Waiver: ".clean_string($waiver)."\n";
$email_message .= "Waiver Date: ".clean_string($waiverdate)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here -->
Your Registration was successfully received, thank you!<br /><br />
<br /><br />
Please make payment: <br /><br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="
[email protected]">
<input type="hidden" name="lc" value="CA">
<input type="hidden" name="item_name" value="SODBUSTER SPORTS">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<table>
<tr><td><input type="hidden" name="on0" value="SODBUSTER SPORTS">SODBUSTER SPORTS</td></tr><tr><td><select name="os0">
<option value="Soccer">Soccer $40.00 CAD</option>
<option value="T-Ball">T-Ball $50.00 CAD</option>
<option value="Soccer + T-ball w T-Shirt">Soccer + T-ball w T-Shirt $75.00 CAD</option>
<option value="Rookie, Mosquito, Peewee & Bantam">Rookie, Mosquito, Peewee & Bantam $90.00 CAD</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="option_select0" value="Soccer">
<input type="hidden" name="option_amount0" value="40.00">
<input type="hidden" name="option_select1" value="T-Ball">
<input type="hidden" name="option_amount1" value="50.00">
<input type="hidden" name="option_select2" value="Soccer + T-ball w T-Shirt">
<input type="hidden" name="option_amount2" value="75.00">
<input type="hidden" name="option_select3" value="Rookie, Mosquito, Peewee & Bantam">
<input type="hidden" name="option_amount3" value="90.00">
<input type="hidden" name="option_index" value="0">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<?php
}
?>
I still can't get it continuously working, sometimes it does, then doesn't so there has to be an issue in it somewhere: