Skip to content

Instantly share code, notes, and snippets.

@billcreswell
Last active August 29, 2015 13:56
Show Gist options
  • Save billcreswell/9164504 to your computer and use it in GitHub Desktop.
Save billcreswell/9164504 to your computer and use it in GitHub Desktop.
Drop in form for job application
<?php
/**
* @brief: job application for websites
* @created: 2010/07
* @todo: classify
*/
// config
$email = "something@example.com"; // recipient
$site = "unknown";
$pagetitle = "Application for Employment";
// process
$timestamp = time();
$date = date("Y-m-d");
$submit_message = "";
$form = "";
$subject = "";
$message = "";
$headers = "";
// template
$template["date"] = $date;
$template["smessage"] = $submit_message;
$template["timestamp"] = $timestamp;
$template["title"] = $pagetitle;
// where from
if(isset( $_SERVER["SERVER_NAME"] )) {
$site = $_SERVER["SERVER_NAME"];
}
// check for post values, and timestamp of less than 20 minutes
// @todo verify separately
if(
isset( $_POST["First_Name"] )
&& ($_POST["First_Name"] != "")
&& ($_POST["First_Name"] != $_POST["Last_Name"])
&& ($timestamp - $_REQUEST["t"] < 1200)
){
// check for spam
$_http = 0;
$_href = 0;
foreach ($_POST as $key => $value){
$key = $value;
// Annoying URL spams in comments any field
$_http += substr_count($value, "http");
$_href += substr_count($value, "href");
}
if ($_http > 1 OR $_href > 1){
die("Sorry, contains too many links or banned words.");
}
// process form results
foreach($_POST as $key => $value){
$form.= ucwords(str_replace("_", " ", $key));
$form.=": " . $value;
$form.="\r\n";
if(($key=="Middle_Name")
||($key=="position")
||($key=="special_qualifications")
||($key=="high_school_years_completed")
||($key=="college_years_completed")
||($key=="other_years_completed")
||($key=="rank_and_duties")
||($key=="employer_1_reason_for_leaving")
||($key=="employer_2_reason_for_leaving")
||($key=="business_reference_1_relationship1")
||($key=="business_reference_2_relationship2")) {
$form.="========\r\n";
}
}
// build email
$subject = "Application for ". $_POST["Last_Name"] . ", " . $_POST["First_Name"];
$headers .= 'From: Website Application <website@' . $site. '>' . "\r\n";
$message = $form;
$semail = $_REQUEST["Email"];
$submit_message="
Thank you for your interest in a career at Morrison.
Your application has been submitted.
-Morrison Industrial Equipment";
// mail application
mail($email,$subject,$message, $headers);
// mail acknowledgement to sender
mail($semail,$subject,$submit_message,$headers);
}
// template vars
$template["date"] = $date;
$template["smessage"] = $submit_message;
$template["timestamp"] = $timestamp;
$template["title"] = "Application for Employment";
#====TEMPLATE=======*/
?>
<html>
<title><?php echo $template["title"] ?></title>
<script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>
<script type="text/javascript">
//<![CDATA[
/* close sections to start (no js, they will stay open) */
window.addEvent('domready', function(){
$$('.section').addClass('hidden');
$('PersonalInformation').removeClass('hidden');
});
/* disable submit until checked*/
window.onload=init;
function init() {
document.getElementById('go').disabled=true;
}
/* check required form elements */
function checkForm() {
$$('.section').removeClass('hidden');
if(document.getElementById('LastName').value == '') {
alert('You have not entered a Last Name');
document.getElementById('LastName').focus();
return false;
}
if(document.getElementById('FirstName').value == '') {
alert('You have not entered a First Name');
document.getElementById('FirstName').focus();
return false;
}
if(document.getElementById('Phone').value == '') {
alert('You have not entered a Phone number');
document.getElementById('Phone').focus();
return false;
}
if(document.getElementById('Date').value == '') {
alert('You have not entered a Date to Confirm your agreement');
document.getElementById('Date').focus();
return false;
}
alert("Looks Good! Press Print or Submit Application");
document.getElementById('go').disabled = false;
return true;
}
//]]>
</script>
<style>
.hidden {display:none}
.required {border:2px red double}
.iwrap { float:left;padding:2px}
.iwrap label {display:block}
.iwrap.border { border:1px #eee solid;padding:2px;margin:4px}
.iwrap.border label {text-align:center}
#Application input[type="radio"],#Application input[type="checkbox"] {
display:inline;
}
#Application textarea {
border:1px solid #B3B3B3;width:100%;border-radius:3px;
}
#Application fieldset {
text-align:left;
font-family:Droid Sans, Tahoma, Arial, san-serif;
border: 1px gainsboro solid;
margin:2px;padding:1px;
}
#Application div {padding:2px}
.gray {
text-shadow:1px 1px #ddd;
background-color:#eee;
padding:4px;margin:4px;border:1px #ddd solid;
border-radius:4px;
background: linear-gradient(top,#eee 0%, #ccc 100%);
background:-moz-linear-gradient(top,#eee, #ccc);
background:-webkit-linear-gradient(top,#eee 0%,#ccc 100%);
background:-ms-linear-gradient(top, #eee 0%,#ccc 100%);
background:-o-linear-gradient(top, #eee 0%,#ccc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee',endColorstr='#cccccc',GradientType=0)}
}
.noprint {text-decoration:none}
@media print{
.noprint {display:hidden}
#TopBar {display:hidden}
}
</style>
<div id="Content">
<p class="inlineNotice"><?php echo $template["smessage"]; ?></p>
<h2>Application For Employment</h2>
<p>All applicants will be considered for employment without regard to race, religion, sex, national origin, age, marital or veteran status, medical condition, or handicap, or any other status protected by law.</p>
<p>We are an Equal Opportunity Employer.</p>
<form name="application" method="post" id="Application">
<input name="Date" id="Date" type="hidden" class="required" value="<?php echo $template["date"]; ?>"/>
<a href="#open" title="Expand all sections (best for screen reader"
onclick="$$('.section').removeClass('hidden')" class="noprint">
Expand All</a> /
<a href="#close" title="Collapse all sections"
onclick="$$('.section').addClass('hidden')" class="noprint">
Collapse All</a>
<fieldset>
<legend class="gray" id="Personal">
<a href="#Personal"
onclick="$$('.section').addClass('hidden');
$('PersonalInformation').removeClass('hidden');">
Personal Information</a>
</legend>
<div id="PersonalInformation" class="section">
<div class="iwrap">
<label for="LastName" >* Last Name:</label>
<input name="Last_Name" id="LastName"
size="30" maxlength="30" class="required" required="required"/>
</div>
<div class="iwrap">
<label for="First_Name">* First Name:</label>
<input name="First_Name" id="FirstName"
size="30" maxlength="30" class="required" required="required"/>
</div>
<div class="iwrap">
<label for="Middle_Name">Middle Name:</label>
<input name="Middle_Name" id="MiddleName"
size="30" maxlength="30"/>
</div>
<br class="cb"/>
<div class="iwrap">
<label for="Address">* Address:</label>
<input name="Address" id="Address"
size="50" maxlength="50" class="required" />
</div>
<div class="iwrap">
<label for="City">City:</label>
<input name="City" id="City"
size="30" maxlength="30" class="required" />
</div>
<div class="iwrap">
<label for="State">St:</label>
<input type="text" name="State" id="State"
size="2" maxlength="2" class="required"/>
</div>
<div class="iwrap">
<label for="Zip">* Zip:</label>
<input name="Zip" id="Zip"
size="12" maxlength="12"class="required" />
</div>
<div class="iwrap">
<label for="Phone">* Phone:</label>
<input name="Phone" id="Phone" type="tel"
placeholder="(xxx) xxx-xxx" size="16" maxlength="16"class="required" />
</div>
<div class="iwrap">
<label for="Email">* E-mail address:</label>
<input name="Email" id="Email" type="email"
size="30" maxlength="30" class="required"/>
</div>
</div>
</fieldset>
<fieldset>
<legend class="gray" id="Position">
<a href="#Position"
onclick="$$('.section').addClass('hidden');
$('PositionInformation').toggleClass('hidden');">
Position Information</a>
</legend>
<div id="PositionInformation" class="section">
<div>
<label class="di">Referred By:</label>
<input type="radio" name="referred_by" id="ourad" value="Our Ad"/>
<label class="di" for="ourad">Our Ad</label>
<input type="radio" name="referred_by" id="friendrel" value="Friend/Relative"/>
<label class="di" for="friendrel">Friend/Relative</label>
<input type="radio" id="other" name="referred_by" value="other"/>
<label class="di" for="other">Other</label>
</div>
<div>
<label for="Eighteen" class="di">Are you over 18 years of age? </label>
<input type="checkbox" name="over18" id="Eighteen"/>
<span>(If not, a work permit will be required)</span>
</div>
<div>
<label for="Legal" class="di">
Are you legally eligibile for permanent employment in this country?</label>
<input type="checkbox" name="legally eligibile" id="Legal" />
<span>(If hired, verification will be required by law.)</span>
</div>
<div>
<label for="position">Position(s) applied for:</label>
<input name="position" id="position" size="30" maxlength="30"/>
<input type="radio" name="full_part_time" id="full-time" value="Full-time" />
<label for="full-time" class="di">Full-time </label>
<input type="radio" name="full_part_time" id="part-time" value="Part-time" />
<label for="part-time" class="di">Part-time</label>
</div>
<div>
<label for="Salary" class="di">Salary or Wages expected: </label>
<input size="10" maxlength="10" name="salary" id="Salary" />
<input name="period" id="hourly" type="radio" value="hourly" />
<label class="di" for="hourly"> Per hour</label>
<input name="period" id="yearly" type="radio" value="yearly" />
<label class="di" for="yearly"> Per year</label>
</div>
<div>
<label for="startdate">Date you are available to start work:</label>
<input type="date" name="start_date" id="startdate" size="30" maxlength="30" />
</div>
<div>
<label for="attend" class="di">
Are you able to meet the attendance requirements of this position?</label>
<input type="checkbox" name="meet_attendance" id="attend" />
</div>
<div>
<label for="transportation" class="di">Do you have reliable transportation?</label>
<input type="checkbox" name="reliable_transportation" id="transportation" />
</div>
<div>
<label for="employed" class="di">Are you currently employed? </label>
<input type="checkbox" name="currently_employed" id="employed" />
</div>
<div>
<label for="overtime" class="di">If hired, will you work overtime if required?</label>
<input type="checkbox" name="work_overtime" id="overtime"/>
</div>
<div>
<label for="conviction" class="di">
Have you been convicted of a felony in the last seven (7) years?</label>
<input type="checkbox" name="convicted_of_felony" id="conviction"/>
<span>(conviction may be relevant if job-related,
but may not bar you from employment)</span>
</div>
<div>
<label for="explainconviction">If yes, please explain:</label>
<textarea name="convictions" id="explainconviction" rows="3" cols="40" ></textarea>
</div>
<div>
<label for="skills">Indicate special qualifications or skills:</label>
<textarea name="special_qualifications" id="skills" rows="3" cols="40" ></textarea>
</div>
</div>
</fieldset>
<!--EDUCATION-->
<fieldset>
<legend class="gray" id="Education">
<a href="#Education"
onclick="$$('.section').addClass('hidden');
$('EducationInformation').toggleClass('hidden');">
Education</a>
</legend>
<div id="EducationInformation" class="section">
<fieldset>
<legend class="gray" >High School</legend>
<div class="iwrap">
<label for="highschool">Name &amp; Location of High School Graduation</label>
<input name="high_school" id="highschool" size="60" maxlength="60" />
</div>
<div class="iwrap">
<label for="highschoolcoursework">Course of Study</label>
<input name="high_school_coursework" id="highschoolcoursework"
size="30" maxlength="30" />
</div>
<div class="iwrap">
<label for="highschoolyearscompleted">Years Completed</label>
<input name="high_school_years_completed" id="highschoolyearscompleted"
size="10" maxlength="10" />
</div>
<br class="cb"/>
<div >
<label for="highschoolgraduate">Did you graduate?
<input type="checkbox" name="high_school_graduate" id="highschoolgraduate" /></label>
</div>
</fieldset>
<fieldset>
<legend class="gray">College</legend>
<div class="iwrap">
<label for="college">Name &amp; Location of College</label>
<input name="college" id="college"
size="60" maxlength="60"/>
</div>
<div class="iwrap">
<label for="collegecoursework">Course of Study</label>
<input name="college_coursework" id="collegecoursework"
size="30" maxlength="30"/>
</div>
<div class="iwrap">
<label for="collegeyearscompleted">Years Completed</label>
<input name="college_years_completed" id="collegeyearscompleted"
size="10" maxlength="10" />
</div>
<br class="cb"/>
<div>
<label for="collegegraduate" class="di">Did you Graduate:</label>
<input type="checkbox" name="college_graduate" id="collegegraduate" />
</div>
</fieldset>
<fieldset>
<legend class="gray">Other Schooling</legend>
<div class="iwrap">
<label for="otherschool">School Name &amp; Location</label>
<input name="other_school" id="otherschool"
size="50" maxlength="50" />
</div>
<div class="iwrap">
<label for="othercoursework">Course of Study:</label>
<input name="other_coursework" id="othercoursework"
size="30" maxlength="30" />
</div>
<div class="iwrap">
<label for="otheryearscompleted">Years Completed:</label>
<input name="other_years_completed" id="otheryearscompleted"
size="10" maxlength="10" />
</div>
<br class="cb"/>
<label for="othergraduate">Did you Graduate:
<input type="checkbox" name="other_graduate" id="othergraduate" /></label>
</fieldset>
</div>
</fieldset>
<fieldset>
<legend class="gray" id="Military">
<a href="#Military"
onclick="$$('.section').addClass('hidden');
$('MilitaryInformation').toggleClass('hidden');">
Military Service</a>
</legend>
<div id="MilitaryInformation" class="section">
<div class="iwrap">
<label for="ServiceBranch">Branch of Service:</label>
<input name="branch_of_service" id="ServiceBranch"
size="35" maxlength="35" />
</div>
<div class="iwrap">
<label for="ServiceDateFrom">From:</label>
<input name="service_date_from" id="ServiceDateFrom" type="date"
size="10" maxlength="10" />
</div>
<div class="iwrap">
<label for="ServiceDateTo">To: </label>
<input name="service_date_to" id="ServiceDateTo" type="date"
size="10" maxlength="10" />
</div>
<div class="iwrap">
<label for="datedischarged">Date Discharged:</label>
<input name="service_date_discharged" id="datedischarged" type="date"
size="10" maxlength="10" />
</div>
<div class="iwrap">
<label for="rankduties">Rank and Duties:</label>
<input name="rank_and_duties" id="rankduties"
size="50" maxlength="50"/>
</div>
</div>
</fieldset>
<fieldset>
<legend class="gray" id="Employment">
<a href="#Employment"
onclick="$$('.section').addClass('hidden');
$('EmploymentInformation').toggleClass('hidden');">Employment History</a>
</legend>
<div id="EmploymentInformation" class="section">
<p>List your most recent employers</p>
<fieldset>
<legend class="gray">Most Recent Employer</legend>
<div class="iwrap">
<label for="Employer1">Employer</label>
<input name="employer1" id="Employer1"
size="35" maxlength="35" />
</div>
<div class="iwrap">
<label for="Employer1JobTitle">Job Title</label>
<input name="employer_1_job_title" id="Employer1JobTitle"
size="30" maxlength="30" />
</div>
<div class="iwrap">
<label for="Employer1DatesFrom">From</label>
<input name="employer_1_starting_date" id="Employer1DatesFrom"
type="date" size="10" maxlength="10"/>
</div>
<div class="iwrap">
<label for="Employer1DatesTo">To</label>
<input name="employer_1_ending_date" id="Employer1DatesTo"
type="date" size="10" maxlength="10"/>
</div>
<div class="iwrap">
<label for="Employer1Responsibilities">
Work performed and responsibilities</label>
<input name="employer_1_responsibilities" id="Employer1Responsibilities"
size="50" maxlength="50"/>
</div>
<div class="iwrap">
<label for="Employer1StartingPay">Starting Pay</label>
<input name="employer_1_starting_pay" id="Employer1StartingPay"
size="8" maxlength="8"/>
</div>
<div class="iwrap">
<label for="Employer1FinalPay">Final Pay</label>
<input name="employer_1_ending_Pay" id="Employer1FinalPay"
size="8" maxlength="8"/>
</div>
<div class="iwrap">
<label for="Employer1Address">Address</label>
<input name="employer_1_address" id="Employer1Address"
size="50" maxlength="50"/>
</div>
<div class="iwrap">
<label for="Employer1Telephone">Telephone</label>
<input type="tel" name="employer_1_phone" id="Employer1Telephone"/>
</div>
<div class="iwrap">
<label for="Employer1Supervisor">Immediate Supervisor and Title</label>
<input name="employer_1_supervisor" id="Employer1Supervisor"
size="35" maxlength="35"/>
</div>
<div class="iwrap">
<label for="Employer1Contact">May we contact this person?</label>
<input name="employer_1_contact" id="Employer1Contact" type="checkbox"/>
</div>
<br class="cb"/>
<div class="iwrap">
<label for="Employer1ReasonForLeaving">Reason for Leaving</label>
<input name="employer_1_reason_for_leaving" id="Employer1ReasonForLeaving"
size="50" maxlength="50"/>
</div>
</fieldset>
<fieldset>
<legend class="gray">Next Most Recent Employer</legend>
<div class="iwrap">
<label for="Employer2">Employer</label>
<input name="employer_2" id="Employer2"
size="35" maxlength="35" />
</div>
<div class="iwrap">
<label for="Employer2Title">Job Title</label>
<input name="employer_2_jobtitle" id="Employer2Title"
size="35" maxlength="35" />
</div>
<div class="iwrap">
<label for="Employer2From">From</label>
<input name="employer_2_starting_date" id="Employer2From" type="date"
size="10" maxlength="10" />
</div>
<div class="iwrap">
<label for="Employer2To">To</label>
<input name="employer_2_ending_date" id="Employer2To" type="date"
size="10" maxlength="10" />
</div>
<div class="iwrap">
<label for="Employer2Responsibilities">
Work performed and responsibilities</label>
<input name="employer_2_responsibilities" id="Employer2Responsibilities"
size="50"/>
</div>
<div class="iwrap">
<label class="di" for="Employer2StartingPay">Starting Pay</label>
<input name="employer_2_starting_pay" id="Employer2StartingPay"
size="10" maxlength="10"/>
</div>
<div class="iwrap">
<label class="di" for="Employer2FinalPay">Final Pay</label>
<input name="employer_2_ending_pay" id="Employer2FinalPay"
size="10" maxlength="10" />
</div>
<div class="iwrap">
<label for="Employer2Address">Address</label>
<input name="employer_2_address" id="Employer2Address"
size="50" maxlength="50" />
</div>
<div class="iwrap">
<label for="Employer2Telephone">Telephone: </label>
<input name="employer_2_phone" id="Employer2Telephone" type="tel"
size="16" maxlength="16" />
</div>
<div class="iwrap">
<label for="Employer2Supervisor">Immediate Supervisor and Title</label>
<input name="employer_2_supervisor" id="Employer2Supervisor"
size="35" maxlength="35"/>
</div>
<div class="iwrap">
<label for="Employer2Contact" class="di">May we contact this person? </label>
<input name="employer_2_contact" id="Employer1Contact" type="checkbox"/>
</div>
<br class="cb"/>
<div class="iwrap">
<label for="Employer2ReasonForLeaving">Reason for Leaving: </label>
<input name="employer_2_reason_for_leaving" id="Employer2ReasonForLeaving"
size="50" maxlength="50" />
</div>
</fieldset>
</div>
</fieldset>
<fieldset>
<legend class="gray" id="#Business">
<a href="#Business"
onclick="$$('.section').addClass('hidden');
$('ReferenceInformation').toggleClass('hidden');">
Business References</a>
</legend>
<div id="ReferenceInformation" class="section">
<fieldset>
<legend class="gray">Reference</legend>
<div class="iwrap">
<label>Name:</label>
<input name="business_reference_1_name"
size="25" maxlength="35" />
</div>
<div class="iwrap">
<label>Address:</label>
<input name="business_reference_1_address"
size="25" maxlength="35"/>
</div>
<div class="iwrap">
<label for="BusinessReference1Phone">Telephone:</label>
<input name="business_reference_1_phone" id="BusinessReference1Phone"
size="16" maxlength="16" type="tel" />
</div>
<div class="iwrap">
<label for="BusinessReference1Relationship">Relationship:</label>
<input name="business_reference_1_relationship" id="BusinessReference1Relationship"
size="20" maxlength="35" />
</div>
</fieldset>
<fieldset>
<legend class="gray">Reference 2</legend>
<div class="iwrap">
<label>Name:</label>
<input name="business_reference_2_name"
size="25" maxlength="30" />
</div>
<div class="iwrap">
<label>Address:</label>
<input name="business_reference_2_address"
size="25" maxlength="30" />
</div>
<div class="iwrap">
<label>Telephone:</label>
<input name="business_reference_2_phone" type="tel"
size="16" maxlength="16" />
</div>
<div class="iwrap">
<label for="businessferencerelationship2">Relationship:</label>
<input name="business_reference_2_relationship" id="businessferencerelationship2"
size="20" maxlength="30" />
</div>
</fieldset>
</div>
</fieldset>
<fieldset>
<legend class="gray" id="Final">
<a href="#Final"
onclick="$$('.section').addClass('hidden');
$('FinalPane').toggleClass('hidden');">Finalize</a>
</legend>
<div id="FinalPane" class="section">
<p> The above information is true and complete to the best of my knowledge.
Should I be employed by the Company, any misrepresentations or false statement
contained herein may be considered cause for possible dismissal.
The company has my permission to obtain all necessary information about the references
I have listed, or any other sources, concerning my prior employment, personal history,
or credit standing and I release all parties from any possible damages resulting
from disclosing such information with or without prior written notice to me.
I reserve the right to know the names and addresses of any investigative agencies used in order that I may learn the information contained in any reports furnished to the company.</p>
<p>All applicants for employment may be required to submit to urinalysis,
blood tests or other screening, as part of the Company's pre-employment drug screening
process, and prior to the employment physical for the purpose of detecting the presence of alcohol or illegal drugs. Applicants tested will be required to sign a Consent/Release form prior to testing; and, any applicant refusing to sign any required form will be disqualified from further consideration. This alcohol and illegal drug screening will be perfromed by a licensed, certified testing service, and all applicants tested may be required to give a sample of the bodily fluid in the presence of another person, usually an employee of the testing service. A positive test may result in denial of employment.</p>
<p>I understand this application does not constitute an employment contract of any kind.
Should I be employed by the Company, I may resign such employment at any time at my
discretion with or without prior notice and the Company may terminate my employment
at any time at their discretion, with or without cause and with or without notice.</p>
<input type='button' onclick='return checkForm();' value="Check Form"
onsubmit='this.disabled=true'/>
<input type="button" onclick="$$('.section').removeClass('hidden');window.print()"
value="Print this Page" />
<input type="submit" id="go" value="Submit Application"/>
<input type="reset" value=" Clear Form "/>
</div>
</fieldset>
<input name="t" value="${timestamp}" type="hidden"/>
</form>
<br class="cb"/>
</div>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment