Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // if form is submitted
- if($_POST['submit']) {
- // if you are using these values to add into a database as well, you may want some more security!
- foreach($_POST as $key => $value) {
- $$key = htmlspecialchars($value);
- }
- $sender = "From: Customer Relations <customer.relations@whatever.com>";
- // required fields
- if($fullName != '' && $email != '' && $address1 != '' && $city != '' && $state != '' && $zip != '' && $education != '' && ($areyou18 != '' || $areyou18 == 1) && $interested != '' && $college != '' && $interests != '' && $familydescribe != '' && $eventexperience != '' && $resume != ''){
- $message_body .= $fullName . ' <' . $email . '> ' . ' submitted the following: ' . "\r\n";
- $message_body .= 'Address: '. "\r\n" . $address1 . "\r\n" . $city . ", " . $state . " " . $zip . "\r\n\r\n";
- $message_body .= 'Phone Number: '. $phone . "\r\n";
- $message_body .= 'Education: '. $education . "\r\n";
- $message_body .= 'Why are you interested in joining the whatever A:Team? '. $interested . "\r\n\r\n";
- $message_body .= 'Are you currently attending college or a university? '. $college . "\r\n";
- $message_body .= 'What are your interests and activities? '. $interests . "\r\n\r\n";
- $message_body .= 'How would your family and friends describe you? '. $familydescribe . "\r\n\r\n";
- $message_body .= 'Do you have any previous event marketing experience? '. $eventexperience . "\r\n\r\n";
- $message_body .= 'Resume: ' . "\r\n" . $resume . "\r\n\r\n";
- $con2 = mysql_connect("localhost:3306","chachacms","@chacha");
- $fullName = mysql_real_escape_string(htmlspecialchars($fullName));
- $email = mysql_real_escape_string(htmlspecialchars($email));
- $address1 = mysql_real_escape_string(htmlspecialchars($address1));
- $city = mysql_real_escape_string(htmlspecialchars($city));
- $state = mysql_real_escape_string(htmlspecialchars($state));
- $zip = mysql_real_escape_string(htmlspecialchars($zip));
- $education = mysql_real_escape_string(htmlspecialchars($education));
- $interested = mysql_real_escape_string(htmlspecialchars($interested));
- $college = mysql_real_escape_string(htmlspecialchars($college));
- $interested = mysql_real_escape_string(htmlspecialchars($interested));
- $interests = mysql_real_escape_string(htmlspecialchars($interests));
- $familydescribe = mysql_real_escape_string(htmlspecialchars($familydescribe));
- $eventExperience = mysql_real_escape_string(htmlspecialchars($eventexperience));
- $resume = mysql_real_escape_string(htmlspecialchars($resume));
- if (!$con2) {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("ateam_apply", $con2);
- mysql_query("INSERT INTO applicant (fullName, address1, city, state, zip, email, phone, education, college, interested, interests, familydescribe, eventexperience, resume, areyou18)
- VALUES ('$fullName', '$address1', '$city', '$state', '$zip', '$email', '$phone', '$education', '$college', '$interestedFormat', '$interests', '$familydescribeFormat', '$eventexperienceFormat', '$resumeFormat', $areyou18)") or die(mysql_error());
- mysql_close($con2);
- // send mail
- mail('bryank@whatever.com', 'A:Team Signup', stripslashes($message_body), $sender);
- $msg = '<p class="success">Thank you. We have received your submission.</p>';
- } else {
- $error = '<p class="errorLarge">All Fields are Required. Please make sure all fields are filled in.</p>';
- }
- if(isset($msg)) {
- echo $msg;
- } else {
- if(isset($error)) {
- echo $error;
- }
- }
- } else {
- $bodycontent = '
- <script type="text/javascript">
- $(document).ready(function(){
- $("#teamSignupForm").submit(function() {
- var error = 0;
- var fullName = $("#fullName");
- var address1 = $("#address1");
- var city = $("#city");
- var state = $("#state");
- var zip = $("#zip");
- var email = $("#email");
- var phone = $("#phone");
- var education = $("#education");
- var areyou18 = $("#areyou18");
- var interested = $("#interested");
- var college = $("#college");
- var interests = $("#interests");
- var familydescribe = $("#familydescribe");
- var eventexperience = $("#eventexperience");
- var resume = $("#resume");
- $(".ateamError").removeClass();
- $("#errorMessage").hide();
- //var errorText = function(msg) { return '<span class="ateamError">' + msg + '</span>' };
- var checkField = function(obj, regex) {
- if (regex ? !regex.test(obj.val()) : (obj.val() == '')) {
- error = 1;
- obj.parent().find("label").addClass("ateamError");
- $("#errorMessage").css("display", "inline").addClass("ateamError");
- if (areyou18.val() != 1) {
- error = 1;
- $("#not18").addClass("ateamError").text("You must be at least 18 to apply");
- } else {
- $("#not18").removeClass("ateamError");
- }
- }
- };
- checkField(fullName);
- checkField(address1);
- checkField(city);
- checkField(state);
- checkField(zip);
- checkField(email, /[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+[.][A-Za-z]{2,4}/);
- checkField(phone);
- checkField(education);
- checkField(interested);
- checkField(college);
- checkField(interests);
- checkField(familydescribe);
- checkField(eventexperience);
- checkField(resume);
- checkField(areyou18);
- if (error == 0) {
- return true;
- } else {
- return false;
- }
- });
- });
- </script>
- <div id="ateamForm">
- <h2>A:Team Signup</h2>
- <p class="error">* All Fields Required!</p>
- <form id="teamSignupForm" method="post" onsubmit="return checkWTL();">
- <input type="hidden" id="submitted" name="submitted" value="submitted" />
- <fieldset>
- <legend>General Information</legend>
- <table id="generalInformation">
- <tr>
- <td>
- <label for="fullName">Name:</label><br />
- <input type="text" name="fullName" id="fullName" maxlength="100" value="<?php echo $fullName; ?>" />
- </td>
- <td>
- <label for="email">Email:</label><br />
- <input type="text" name="email" id="email" maxlength="50" value="<?php echo $email; ?>" />
- </td>
- <td>
- <label for="phone">Phone:</label><br />
- <input type="text" name="phone" id="phone" maxlength="12" value="<?php echo $phone; ?>" />
- </td>
- </tr>
- <tr>
- <td colspan="3">
- <label for="address1">Address:</label><br />
- <input type="text" name="address1" maxlength="100" id="address1" value="<?php echo $address1; ?>" />
- </td>
- </tr>
- <tr>
- <td>
- <label for="city">City:</label><br />
- <input type="text" name="city" maxlength="50" id="city" value="<?php echo $city; ?>" />
- </td>
- <td>
- <label for="state">State</label><br />
- <select name="state" id="state">
- <option value="" selected="selected">Select a State</option>
- <option value="AL">Alabama</option>
- <option value="AK">Alaska</option>
- <option value="AZ">Arizona</option>
- <option value="AR">Arkansas</option>
- <option value="CA">California</option>
- <option value="CO">Colorado</option>
- <option value="CT">Connecticut</option>
- <option value="DE">Delaware</option>
- <option value="DC">District Of Columbia</option>
- <option value="FL">Florida</option>
- <option value="GA">Georgia</option>
- <option value="HI">Hawaii</option>
- <option value="ID">Idaho</option>
- <option value="IL">Illinois</option>
- <option value="IN">Indiana</option>
- <option value="IA">Iowa</option>
- <option value="KS">Kansas</option>
- <option value="KY">Kentucky</option>
- <option value="LA">Louisiana</option>
- <option value="ME">Maine</option>
- <option value="MD">Maryland</option>
- <option value="MA">Massachusetts</option>
- <option value="MI">Michigan</option>
- <option value="MN">Minnesota</option>
- <option value="MS">Mississippi</option>
- <option value="MO">Missouri</option>
- <option value="MT">Montana</option>
- <option value="NE">Nebraska</option>
- <option value="NV">Nevada</option>
- <option value="NH">New Hampshire</option>
- <option value="NJ">New Jersey</option>
- <option value="NM">New Mexico</option>
- <option value="NY">New York</option>
- <option value="NC">North Carolina</option>
- <option value="ND">North Dakota</option>
- <option value="OH">Ohio</option>
- <option value="OK">Oklahoma</option>
- <option value="OR">Oregon</option>
- <option value="PA">Pennsylvania</option>
- <option value="RI">Rhode Island</option>
- <option value="SC">South Carolina</option>
- <option value="SD">South Dakota</option>
- <option value="TN">Tennessee</option>
- <option value="TX">Texas</option>
- <option value="UT">Utah</option>
- <option value="VT">Vermont</option>
- <option value="VA">Virginia</option>
- <option value="WA">Washington</option>
- <option value="WV">West Virginia</option>
- <option value="WI">Wisconsin</option>
- <option value="WY">Wyoming</option>
- </select>
- </td>
- <td>
- <label for="zip">Zip:</label><br />
- <input type="text" name="zip" maxlength="15" id="zip" style="width: 90px;" value="<?php echo $zip; ?>" />
- </td>
- </tr>
- <tr>
- <td colspan="3">
- <label for="education">Education Level:</label><br />
- <select name="education" id="education">
- <option value="">Choose One</option>
- <option value="High School">High School</option>
- <option value="Some College">Some College</option>
- <option value="Associates Degree">Associates Degree</option>
- <option value="Bachelors Degree">Bachelors Degree</option>
- <option value="Bachelors Degree">Masters Degree</option>
- </select>
- </td>
- </tr>
- </table>
- </fieldset>
- <fieldset>
- <legend>Personal Information</legend>
- <p>
- <label for="interested">Why are you interested in joining the ChaCha A:Team?</label>
- <br />
- <textarea name="interested" id="interested" maxlength="255" style="width: 300px; height: 100px;"><?php echo $interested; ?></textarea>
- </p>
- <p>
- <label for="college">Are you currently attending college or a university?</label>
- <br />
- <input type="text" name="college" maxlength="255" style="width: 300px;" id="college" value="<?php echo $college; ?>" />
- </p>
- <p>
- <label for="interests">What are your interests and activities?</label>
- <br />
- <input type="text" name="interests" maxlength="255" style="width: 300px;" id="interests" value="<?php echo $interests; ?>" /><br />
- <small>(separate with commas)</small>
- </p>
- <p>
- <label for="describe">How would your family and friends describe you?</label>
- <br />
- <textarea name="familydescribe" style="width: 300px; height: 100px;" id="familydescribe"><?php echo $familydescribe; ?></textarea>
- </p>
- <p>
- <label for="eventexperience">Do you have any previous event marketing experience?</label>
- <br />
- <textarea name="eventexperience" style="width: 300px; height: 100px;" id="eventexperience"><?php echo $eventexperience; ?></textarea>
- </p>
- <p>
- <label for="resume">Paste your Resume in this box</label>
- <br />
- <textarea name="resume" style="width: 500px; height: 300px;" id="resume"><?php echo $resume; ?></textarea>
- </p>
- <!--<p> Check this box to verify you
- <input type="checkbox" value="1" name="checkmeImreal" id="checkmeImreal" />
- </p>-->
- <p>
- <label for="areyou18" id="not18">You must be 18 to apply. Are you?</label><br />
- <select name="areyou18" id="areyou18">
- <option value="">Choose</option>
- <option value="1">Yes</option>
- <option value="0">No</option>
- </select>
- </p>
- <p class="formField">
- <input type="submit" name="submit" value="Send" id="submitForm" class="submit" /> <span class="ateamError" id="errorMessage" style="display: none;">Please review the errors above</span>
- </p>
- </fieldset>
- </form>
- </div>'; } // End else here
- ?>
- <html><head></head><body><?php echo $bodycontent; ?></body></html>
Add Comment
Please, Sign In to add comment