Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if($_POST['formSubmit'] == "Submit")
- {
- $errorMessage = "";
- if(empty($_POST['agreeName']))
- {
- $errorMessage .= "<li>You forgot to sign the release.</li>";
- }
- if(empty($_POST['last_name']))
- {
- $errorMessage .= "<li>You forgot to enter your a last name!</li>";
- }
- if(empty($_POST['first_name']))
- {
- $errorMessage .= "<li>You forgot to enter your first name!</li>";
- }
- if(empty($_POST['age']))
- {
- $errorMessage .= "<li>You forgot to enter your age.</li>";
- }
- if(empty($_POST['gender']))
- {
- $errorMessage .= "<li>You forgot to enter your gender.</li>";
- }
- if(empty($_POST['phone']))
- {
- $errorMessage .= "<li>You forgot to enter your phone number.</li>";
- }
- if(empty($_POST['email']))
- {
- $errorMessage .= "<li>You forgot to enter an email!</li>";
- }
- if(empty($_POST['street_no']))
- {
- $errorMessage .= "<li>You need to enter the address where you currently reside.</li>";
- }
- if(empty($_POST['city']))
- {
- $errorMessage .= "<li>You need to enter the city where you currently reside.</li>";
- }
- if(empty($_POST['state']))
- {
- $errorMessage .= "<li>You need to enter the state where you currently reside.</li>";
- }
- if(empty($_POST['zip']))
- {
- $errorMessage .= "<li>You need to enter your zipcode.</li>";
- }
- if(empty($_POST['attended']))
- {
- $errorMessage .= "<li>Please answer the question: Have you attended...</li>";
- }
- if(empty($_POST['volbefore']))
- {
- $errorMessage .= "<li>Please answer the question: Have you volunteered...</li>";
- }
- if(empty($_POST['volbeforeyes']))
- {
- $errorMessage .= "<li>Please answer the question: If you have volunteered...</li>";
- }
- if(empty($_POST['cpr']))
- {
- $errorMessage .= "<li>Please answer the question: Are you CPR certified?</li>";
- }
- if(empty($_POST['tabc']))
- {
- $errorMessage .= "<li>Please answer the question: Are you TABC certified?</li>";
- }
- if(empty($_POST['skills']))
- {
- $errorMessage .= "<li>Please answer the question: What are your skills?</li>";
- }
- if(empty($_POST['avail']))
- {
- $errorMessage .= "<li>Please answer the question: What is your availability?</li>";
- }
- if(empty($_POST['shirt']))
- {
- $errorMessage .= "<li>Please tell us your shirt size.</li>";
- }
- $agreeName = $_POST['agreeName'];
- $last_name = $_POST['last_name'];
- $first_name = $_POST['first_name'];
- $age = $_POST['age'];
- $gender = $_POST['gender'];
- $phone = $_POST['phone'];
- $email = $_POST['email'];
- $facebook = $_POST['facebook'];
- $street_no = $_POST['street_no'];
- $city = $_POST['city'];
- $state = $_POST['state'];
- $zip = $_POST['zip'];
- $attended = $_POST['attended'];
- $volbefore = $_POST['volbefore'];
- $volbeforeyes = $_POST['volbeforeyes'];
- $cpr = $_POST['cpr'];
- $tabc = $_POST['tabc'];
- $skills = $_POST['skills'];
- $avail = $_POST['avail'];
- $shirt = $_POST['shirt'];
- if(empty($errorMessage))
- {
- $db = mysql_connect("host", "DBNAME", "pword");
- if(!$db) die("Error connecting to MySQL database.");
- mysql_select_db("DBNAME" ,$db);
- function checkEmail($email) {
- $email = mysql_real_escape_string($email);
- $sql = mysql_query("SELECT * FROM vols2012 WHERE email='$email'");
- if (mysql_num_rows($sql) == 0) {
- return true;
- }
- return false;
- }
- if (checkEmail($_POST['email'])) {
- // Continue insert
- } else {die( "There is already a user with that email!" ) ;
- }//end if
- $sql = "INSERT INTO vols2012 (agreeName, last_name, first_name, age, gender, phone, email, facebook, street_no, city, state, zip, attended, volbefore, volbeforeyes, cpr, tabc, skills, avail, shirt)
- VALUES (".
- PrepSQL($agreeName) . ", " .
- PrepSQL($last_name) . ", " .
- PrepSQL($first_name) . ", " .
- PrepSQL($age) . ", " .
- PrepSQL($gender) . ", " .
- PrepSQL($phone) . ", " .
- PrepSQL($email) . ", " .
- PrepSQL($facebook) . ", " .
- PrepSQL($street_no) . ", " .
- PrepSQL($city) . ", " .
- PrepSQL($state) . ", " .
- PrepSQL($zip) . ", " .
- PrepSQL($attended) . ", " .
- PrepSQL($volbefore) . ", " .
- PrepSQL($volbeforeyes) . ", " .
- PrepSQL($cpr) . ", " .
- PrepSQL($tabc) . ", " .
- PrepSQL($skills) . ", " .
- PrepSQL($avail) . ", " .
- PrepSQL($shirt) . ")";
- mysql_query($sql);
- header("Location: volthankyou.php");
- exit();
- }
- }
- // function: PrepSQL()
- // use stripslashes and mysql_real_escape_string PHP functions
- // to sanitize a string for use in an SQL query
- //
- // also puts single quotes around the string
- //
- function PrepSQL($value)
- {
- // Stripslashes
- if(get_magic_quotes_gpc())
- {
- $value = stripslashes($value);
- }
- // Quote
- $value = "'" . mysql_real_escape_string($value) . "'";
- return($value);
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- </head>
- <body>
- <!-- Form Left start -->
- <?php
- if(!empty($errorMessage))
- {
- echo("<p>There was an error with your form:</p>\n");
- echo("<ul>" . $errorMessage . "</ul>\n");
- }
- ?>
- <form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
- <div id="volApp" class="form_left">
- <fieldset>
- <br /> <br />
- <label>First name<br /><input type="text" name="first_name" placeholder="Contact First Name" value="<?=$first_name;?>" /></label>
- <label>Last name<br /><input type="text" name="last_name" placeholder="Contact Last Name" value="<?=$last_name;?>" /></label>
- Age <input style="height: 10px; margin-right: 12px; width: 18px" type="text" name="age" value="<?=$age;?>" /> Gender <input type="radio" name="gender" value="female">F <input type="radio" name="gender" value="male" checked>M
- <br />
- <label>Contact phone<br /><input type="text" name="phone" placeholder="xxx-xxx-xxxx" value="<?=$phone;?>" /></label>
- <label>Email<br /><input type="email" name="email" placeholder="Email Address" value="<?=$email;?>" /></label>
- <label>Street<br /><input type="text" name="street_no" placeholder="Mailing Address" value="<?=$street_no;?>" /></textarea></label>
- <label>City<br /><input type="text" name="city" placeholder="City" value="<?=$city;?>" /></label>
- <label>State<br /><input type="text" name="state" placeholder="State" value="<?=$state;?>" /></label>
- <label>Zip<br /><input type="text" name="zip" placeholder="Zipcode" value="<?=$zip;?>" /></label>
- <label>Have you volunteered for the fest before?
- <input type="radio" name="volbefore" value="yes">YES
- <input type="radio" name="volbefore" value="no" checked>NO<br/ >
- </label>
- <label>If no, have you attended the fest as a guest?
- <input type="radio" name="attended" value="yes">YES
- <input type="radio" name="attended" value="no" checked>NO<br/ >
- </label>
- <label>If yes, what year(s), shifts/positions did you cover?<br/ >
- <textarea placeholder="Ex. 2010, 2011, Sat. pm/Sun. am, wristbander, first aid, booth" name="volbeforeyes" id="bigarea" value="<?=$volbeforeyes;?>" /></textarea></label>
- <label>Are you TABC certified?
- <input type="radio" name="tabc" value="yes">YES
- <input type="radio" name="tabc" value="no" checked>NO<br/ >
- </label>
- <label>Are you CPR certified?
- <input type="radio" name="cpr" value="yes">YES
- <input type="radio" name="cpr" value="no" checked>NO<br/ >
- </label>
- <label>List skills you have that can be put to good use at the fest.<br/ >
- <textarea placeholder="Ex. CPR, strong, math, loud, can't stop/won't stop (No photographers please)" name="skills" id="bigarea" value="<?= $skills;?>" /></textarea></label>
- <label>A.M. shifts run from around 9am to 4pm and P.M. shifts from 3:30pm to around 11pm. While it's a ways off, do you currently know of any restrictions to your schedule that would prevent you from being available for any of these shifts?<br/ >
- <textarea placeholder="Ex.: NOPE, All yours!, Yes- Graduation Sat A.M." name="avail" id="bigarea" value="<?= $avail;?>" /></textarea></label>
- <label>What's your name on Facebook?<br />
- <input type="text" name="facebook" value="<?= $facebook;?>" /> </label>
- <label>T-SHIRT SIZE
- <input type="radio" name="shirt" value="small" checked>S
- <input type="radio" name="shirt" value="medium"> M
- <input type="radio" name="shirt" value="large" >L
- <input type="radio" name="shirt" value="XL"> XL
- <input type="radio" name="shirt" value="XXL"> XXL
- </label>
- <br /><br />
- </fieldset>
- </div>
- <!-- Form Left end -->
- <!-- Form Right start -->
- <div class="form_right">
- <fieldset>
- <div id="release">
- <h2 class="bigboldfont">RELEASE</h2>
- <label>First and Last name <input style="width:230px; margin-top:10px" type="text" name="agreeName" value="<?=$agreeName;?>" /></label>
- </div>
- <div style="height:60px">
- <div id="verQ"><label>Spam verification: 3+1= <input type="text" name="hii" placeholder="?"></label></div>
- <input class="float-right btnSubmit" type="submit" value="Submit" name="formSubmit" id="submit">
- </div>
- </fieldset>
- </div>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement