if (isset($_POST['submit']) && $_POST['submit'] = "Submit") { ?>
// init vars
$success = 1;
$edition = 2015;
// set vars and deal with mandatory fields
if (isset($_POST['fullName']) && ($_POST['fullName'] != "") && ($_POST['fullName'] != " ")) {
$fullName = $_POST['fullName'];
} else {
echo 'Don\'t be shy. Please tell us your name.
';
$success = 0;
}
if (isset($_POST['emailAddress']) && ($_POST['emailAddress'] != "") && ($_POST['emailAddress'] != " ")) {
$emailAddress = $_POST['emailAddress'];
} else {
echo 'We need to know your email address. Please fill it in.
';
$success = 0;
}
if (isset($_POST['tel']) && ($_POST['tel'] != "") && ($_POST['tel'] != " ")) {
$tel = $_POST['tel'];
} else {
echo 'Without your telephone number we can\'t contact you out in the wild!
';
$success = 0;
}
if (isset($_POST['address']) && ($_POST['address'] != "") && ($_POST['address'] != " ")) {
$address = $_POST['address'];
} else {
echo 'We need your address to send you something very special!
';
$success = 0;
}
if (isset($_POST['proposal'])) {
$proposal = $_POST['proposal'];
} else {
$proposal = "";
}
// Securimage CAPTCHA
include_once 'securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($_POST['captcha_code']) == false) {
echo 'Please try to type in the correct CAPTCHA code.
';
$success = 0;
}
// On error, show a back link
if ($success == 0) {
echo 'back
';
}
if ($success == 1) {
// init vars
$adminEmail = "bxl.wildlife@gmail.com";
$emailText = "Dear {$fullName}\n\n
Thank you for your inscription to BXL.WILDLIFE FESTIVAL 2016 !\n\n
We will send you soon further instructions.\n\n
Wild kisses,\n\n
Your dear brussels wildlife services team.";
// insert record to db
// database friendly vars
$db_fullName = mysql_escape_string($fullName);
$db_emailAddress = mysql_escape_string($emailAddress);
$db_address = mysql_escape_string($address);
$db_proposal = mysql_escape_string($proposal);
$db_tel = mysql_escape_string($tel);
$db_edition = $edition;
$insert = "insert into inscriptions (fullName,emailAddress,address,proposal,edition,tel) values ('" . $db_fullName . "','" . $db_emailAddress . "','" . $db_address . "','" . $db_proposal . "'," . $db_edition . ",'" . $db_tel . "')";
$result = mysql_query($insert);
//echo mysql_affected_rows(); exit();
if (mysql_affected_rows() != 1) {
echo 'Error adding record. '; exit();
}
// send email to punter
$body = $emailText;
mail($emailAddress,'Wildlife Inscription',$body,'From: '. $adminEmail);
// send email to team
$body = "{$fullName}\n{$emailAddress}\n{$address}\n{$tel}";
mail($adminEmail,'Wildlife Inscription',$body,'From: ' . $emailAddress);
// redirect
//header("Location: ../index2.html");
echo '';
}
?>
} else if (isset($_GET['s']) && $_GET['s'] = "1") { ?>
Thank you for your inscription to BXL.WILDLIFE FESTIVAL 2016 !