"") { $a = "C"; // copy record } else{ $a = "I"; // display blank record } } // open connection to the database $conn = mysql_connect(HOST, USER, PASS); mysql_select_db(DB); switch ($a) { case "C": // get a record to display $tkey = "" . $key . ""; $strsql = "SELECT * FROM `NewHire` WHERE `id`=" . $tkey; $rs = mysql_query($strsql); if (mysql_num_rows($rs) == 0) { ob_end_clean(); header("Location: newhirelist.php"); } else { $row = mysql_fetch_array($rs); // get the field contents //$x_id = @$row["id"]; $x_name = @$row["name"]; $x_firstname = @$row["firstname"]; $x_middleinitial = @$row["middleinitial"]; $x_lastname = @$row["lastname"]; $x_pres_addr = @$row["pres_addr"]; $x_pres_addr2 = @$row["pres_addr2"]; $x_pres_mth = @$row["pres_mth"]; $x_pres_yrs = @$row["pres_yrs"]; $x_prev_addr = @$row["prev_addr"]; $x_prev_addr2 = @$row["prev_addr2"]; $x_prev__mth = @$row["prev__mth"]; $x_prev__yrs = @$row["prev__yrs"]; $x_phone = @$row["phone"]; $x_phone1 = @$row["phone1"]; $x_phone2 = @$row["phone2"]; $x_phone3 = @$row["phone3"]; $x_ssn = @$row["ssn"]; $x_ssn1 = @$row["ssn1"]; $x_ssn2 = @$row["ssn2"]; $x_ssn3 = @$row["ssn3"]; $x_q1 = @$row["q1"]; $x_q1_cmt = @$row["q1_cmt"]; $x_q2 = @$row["q2"]; $x_q2_cmt = @$row["q2_cmt"]; $x_q3 = @$row["q3"]; $x_q3_cmt = @$row["q3_cmt"]; $x_pres_empl = @$row["pres_empl"]; $x_pres_empl_addr = @$row["pres_empl_addr"]; $x_pres_empl_addr2 = @$row["pres_empl_addr2"]; $x_pres_empl_city = @$row["pres_empl_city"]; $x_pres_empl_state = @$row["pres_empl_state"]; $x_pres_empl_zip = @$row["pres_empl_zip"]; $x_pres_empl_phone = @$row["pres_empl_phone"]; $x_pres_empl_phone1 = @$row["pres_empl_phone1"]; $x_pres_empl_phone2 = @$row["pres_empl_phone2"]; $x_pres_empl_phone3 = @$row["pres_empl_phone3"]; $x_pres_empl_yr_st = @$row["pres_empl_yr_st"]; $x_pres_empl_yr_st_mth = @$row["pres_emp_yr_st_mth"]; $x_pres_empl_yr_st_yr = @$row["pres_emp_yr_st_yr"]; $x_pres_empl_yr_end = @$row["pres_empl_yr_end"]; $x_pres_empl_yr_end_mth = @$row["pres_empl_yr_end_mth"]; $x_pres_empl_yr_end_yr = @$row["pres_empl_yr_end_yr"]; $x_res_empl_pay_st = @$row["res_empl_pay_st"]; $x_pres_empl_pay_st_dol = @$row["pres_empl_pay_st_dol"]; $x_pres_empl_pay_st_cen = @$row["pres_empl_pay_st_cen"]; $x_pres_empl_pay_end = @$row["pres_empl_pay_end"]; $x_pres_empl_pay_end_dol = @$row["pres_empl_pay_end_dol"]; $x_pres_empl_pay_end_cen = @$row["pres_empl_pay_end_cen"]; $x_pres_empl_title = @$row["pres_empl_title"]; $x_pres_empl_super = @$row["pres_empl_super"]; $x_pres_empl_reason = @$row["pres_empl_reason"]; $x_prev_empl = @$row["pres_empl"]; $x_prev_empl_addr = @$row["pres_empl_addr"]; $x_prev_empl_addr2 = @$row["pres_empl_addr2"]; $x_prev_empl_city = @$row["pres_empl_city"]; $x_prev_empl_state = @$row["pres_empl_state"]; $x_prev_empl_zip = @$row["pres_empl_zip"]; $x_prev_empl_phone = @$row["pres_empl_phone"]; $x_prev_empl_phone1 = @$row["pres_empl_phone1"]; $x_prev_empl_phone2 = @$row["pres_empl_phone2"]; $x_prev_empl_phone3 = @$row["pres_empl_phone3"]; $x_prev_empl_yr_st = @$row["pres_empl_yr_st"]; $x_prev_empl_yr_st_mth = @$row["pres_emp_yr_st_mth"]; $x_prev_empl_yr_st_yr = @$row["pres_emp_yr_st_yr"]; $x_prev_empl_yr_end = @$row["pres_empl_yr_end"]; $x_prev_empl_yr_end_mth = @$row["pres_empl_yr_end_mth"]; $x_prev_empl_yr_end_yr = @$row["pres_empl_yr_end_yr"]; $x_prev_empl_pay_st = @$row["res_empl_pay_st"]; $x_prev_empl_pay_st_dol = @$row["pres_empl_pay_st_dol"]; $x_prev_empl_pay_st_cen = @$row["pres_empl_pay_st_cen"]; $x_prev_empl_pay_end = @$row["pres_empl_pay_end"]; $x_prev_empl_pay_end_dol = @$row["pres_empl_pay_end_dol"]; $x_prev_empl_pay_end_cen = @$row["pres_empl_pay_end_cen"]; $x_prev_empl_title = @$row["pres_empl_title"]; $x_prev_empl_super = @$row["pres_empl_super"]; $x_prev_empl_reason = @$row["pres_empl_reason"]; $x_prev2_empl = @$row["pres_empl"]; $x_prev2_empl_addr = @$row["pres_empl_addr"]; $x_prev2_empl_addr2 = @$row["pres_empl_addr2"]; $x_prev2_empl_city = @$row["pres_empl_city"]; $x_prev2_empl_state = @$row["pres_empl_state"]; $x_prev2_empl_zip = @$row["pres_empl_zip"]; $x_prev2_empl_phone = @$row["pres_empl_phone"]; $x_prev2_empl_phone1 = @$row["pres_empl_phone1"]; $x_prev2_empl_phone2 = @$row["pres_empl_phone2"]; $x_prev2_empl_phone3 = @$row["pres_empl_phone3"]; $x_prev2_empl_yr_st = @$row["pres_empl_yr_st"]; $x_prev2_empl_yr_st_mth = @$row["pres_emp_yr_st_mth"]; $x_prev2_empl_yr_st_yr = @$row["pres_emp_yr_st_yr"]; $x_prev2_empl_yr_end = @$row["pres_empl_yr_end"]; $x_prev2_empl_yr_end_mth = @$row["pres_empl_yr_end_mth"]; $x_prev2_empl_yr_end_yr = @$row["pres_empl_yr_end_yr"]; $x_prev2_empl_pay_st = @$row["res_empl_pay_st"]; $x_prev2_empl_pay_st_dol = @$row["pres_empl_pay_st_dol"]; $x_prev2_empl_pay_st_cen = @$row["pres_empl_pay_st_cen"]; $x_prev2_empl_pay_end = @$row["pres_empl_pay_end"]; $x_prev2_empl_pay_end_dol = @$row["pres_empl_pay_end_dol"]; $x_prev2_empl_pay_end_cen = @$row["pres_empl_pay_end_cen"]; $x_prev2_empl_title = @$row["pres_empl_title"]; $x_prev2_empl_super = @$row["pres_empl_super"]; $x_prev2_empl_reason = @$row["pres_empl_reason"]; $x_emp_gaps = @$row["emp_gaps"]; $x_accomplish = @$row["accomplish"]; $x_agree = @$row["agree"]; $x_signature = @$row["signature"]; $x_date = @$row["date"]; $x_date_mth = @$row["date"]; $x_date_day = @$row["day"]; $x_date_yr = @$row["yr"]; } mysql_free_result($rs); break; case "A": // add // PDF GENERATION START include ('class.ezpdf.php'); $pdf =& new Cezpdf(); $pdf->selectFont('./fonts/Helvetica.afm'); $pdf->ezSetMargins(50,30,30,30); $pdf->ezText('Unique PEO NEW HIRE FORM (Texas)',20); $pdf->ezText('',10); $pdf->ezText('Name: '.$x_name,10); $pdf->ezText('Previous Address: '.$x_pres_addr,10); $pdf->ezText('How long have you lived there? '.$x_pres_yrs,10); $pdf->ezText('Present Address: '.$x_prev_addr,10); $pdf->ezText('How long have you lived there? '.$x_prev__yrs,10); $pdf->ezText('PHone Number: '.$x_phone,10); $pdf->ezText('Social Security Number: '.$x_ssn,10); $pdf->ezText('',10); $pdf->ezText('Have you ever worked for this Company before? '.$x_q1,10); $pdf->ezText('Details: '.$x_q1_cmt,10); $pdf->ezText('',10); $pdf->ezText('Have you ever pled guilty or no contest to, or been convicted of any midemenor or felony? '.$x_q2,10); $pdf->ezText('Details: '.$x_q2_cmt,10); $pdf->ezText('',10); $pdf->ezText('Have you been arrested for any matters for which you are out on bail or on your own recognizance pending trial? '.$x_q3,10); $pdf->ezText('Detials: '.$x_q3_cmt,10); $pdf->ezText('',10); $pdf->ezText('RECORD OF PREVIOUS EMPLOYMENT',10); $pdf->ezText('',10); $pdf->ezText('Please list the names of your previous emplolyers in chronological order with present or last employer listed first. Be sure to account for all periods of time including military service and any period of unemployment. If self-employed, give firm name and supply business refernece under emplyment gaps.',10); $pdf->ezText('',10); $pdf->ezText('Present or Last Employer: '.$x_pres_empl,10); $pdf->ezText('Address'.$x_pres_empl_addr,10); $pdf->ezText('City, State, Zip Code'.$x_pres_empl_city,10); $pdf->ezText('Telephone'.$x_pres_empl_phone,10); $pdf->ezText('Employed from (mo/yr) '.$x_pres_empl_yr_st.' to '.$x_pres_empl_yr_end,10); $pdf->ezText('Pay Start: '.$x_res_empl_pay_st,10); $pdf->ezText('Pay Final: '.$x_pres_empl_pay_end,10); $pdf->ezText('Your Title or Position'.$x_pres_empl_title,10); $pdf->ezText('Name and Title of Last Supervisor'.$x_pres_empl_super,10); $pdf->ezText('Exact Reason for Leaving:',10); $pdf->ezText(''.$x_pres_empl_reason,10); $pdf->ezText('',10); $pdf->ezText('Previous Employer'.$x_prev_empl,10); $pdf->ezText('Address'.$x_prev_empl_addr,10); $pdf->ezText('City, State, Zip Code'.$x_prev_empl_city,10); $pdf->ezText('Telephone'.$x_prev_empl_phone,10); $pdf->ezText('Employed from (mo/yr) '.$x_prev_empl_yr_st.' to '.$x_prev_empl_yr_end,10); $pdf->ezText('Pay Start: '.$x_prev_empl_pay_st,10); $pdf->ezText('Pay Final: '.$x_prev_empl_pay_end,10); $pdf->ezText('Your Title or Position'.$x_prev_empl_title,10); $pdf->ezText('Name and Title of Last Supervisor'.$x_prev_empl_super,10); $pdf->ezText('Exact Reason for Leaving:',10); $pdf->ezText(''.$x_prev_empl_reason,10); $pdf->ezText('',10); $pdf->ezNewPage(); $pdf->ezText('Employee Gaps:',10); $pdf->ezText(''.$x_emp_gaps,10); $pdf->ezText('',10); $pdf->ezText('Are you cabable of performing the essantial job duties of the potiion you are being hired for with or without reasonable accomidations? (If not what accomidations would be necessary?',10); $pdf->ezText(''.$x_accomplish,10); $pdf->ezText('',10); $pdf->ezText('I CERTIFY THAT ALL THE INFORMATION I HAVE PROVIDED ON THIS FORM IS TURE AND ACCURATE: '.$x_agree,10); $pdf->ezText('',10); $pdf->ezText('Digital Signature'.$x_signature,10); $pdf->ezText('Date: '.$x_date,10); $pdfcode = $pdf->ezOutput(); $fp=fopen('newhireform.pdf','wb'); fwrite($fp,$pdfcode); fclose($fp); // get the form values //$x_id = @$HTTP_POST_VARS["x_id"]; $x_name = @$HTTP_POST_VARS["x_name"]; $x_pres_addr = @$HTTP_POST_VARS["x_pres_addr"]; $x_pres_yrs = @$HTTP_POST_VARS["x_pres_yrs"]; $x_prev_addr = @$HTTP_POST_VARS["x_prev_addr"]; $x_prev__yrs = @$HTTP_POST_VARS["x_prev__yrs"]; $x_phone = @$HTTP_POST_VARS["x_phone"]; $x_ssn = @$HTTP_POST_VARS["x_ssn"]; $x_q1 = @$HTTP_POST_VARS["x_q1"]; $x_q1_cmt = @$HTTP_POST_VARS["x_q1_cmt"]; $x_q2 = @$HTTP_POST_VARS["x_q2"]; $x_q2_cmt = @$HTTP_POST_VARS["x_q2_cmt"]; $x_q3 = @$HTTP_POST_VARS["x_q3"]; $x_q3_cmt = @$HTTP_POST_VARS["x_q3_cmt"]; $x_pres_empl = @$HTTP_POST_VARS["x_pres_empl"]; $x_pres_empl_addr = @$HTTP_POST_VARS["x_pres_empl_addr"]; $x_pres_empl_city = @$HTTP_POST_VARS["x_pres_empl_city"]; $x_pres_empl_phone = @$HTTP_POST_VARS["x_pres_empl_phone"]; $x_pres_empl_yr_st = @$HTTP_POST_VARS["x_pres_empl_yr_st"]; $x_pres_empl_yr_end = @$HTTP_POST_VARS["x_pres_empl_yr_end"]; $x_res_empl_pay_st = @$HTTP_POST_VARS["x_res_empl_pay_st"]; $x_pres_empl_pay_end = @$HTTP_POST_VARS["x_pres_empl_pay_end"]; $x_pres_empl_title = @$HTTP_POST_VARS["x_pres_empl_title"]; $x_pres_empl_super = @$HTTP_POST_VARS["x_pres_empl_super"]; $x_pres_empl_reason = @$HTTP_POST_VARS["x_pres_empl_reason"]; $x_prev_empl = @$HTTP_POST_VARS["x_prev_empl"]; $x_prev_empl_addr = @$HTTP_POST_VARS["x_prev_empl_addr"]; $x_prev_empl_city = @$HTTP_POST_VARS["x_prev_empl_city"]; $x_prev_empl_phone = @$HTTP_POST_VARS["x_prev_empl_phone"]; $x_prev_empl_yr_st = @$HTTP_POST_VARS["x_prev_empl_yr_st"]; $x_prev_empl_yr_end = @$HTTP_POST_VARS["x_prev_empl_yr_end"]; $x_prev_empl_pay_st = @$HTTP_POST_VARS["x_prev_empl_pay_st"]; $x_prev_empl_pay_end = @$HTTP_POST_VARS["x_prev_empl_pay_end"]; $x_prev_empl_title = @$HTTP_POST_VARS["x_prev_empl_title"]; $x_prev_empl_super = @$HTTP_POST_VARS["x_prev_empl_super"]; $x_prev_empl_reason = @$HTTP_POST_VARS["x_prev_empl_reason"]; $x_emp_gaps = @$HTTP_POST_VARS["x_emp_gaps"]; $x_accomplish = @$HTTP_POST_VARS["x_accomplish"]; $x_agree = @$HTTP_POST_VARS["x_agree"]; $x_signature = @$HTTP_POST_VARS["x_signature"]; $x_date = @$HTTP_POST_VARS["x_date"]; // add the values into an array // name $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_name) : $x_name; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`name`"] = $theValue; // pres_addr $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_pres_addr) : $x_pres_addr; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`pres_addr`"] = $theValue; // pres_yrs $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_pres_yrs) : $x_pres_yrs; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`pres_yrs`"] = $theValue; // prev_addr $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_prev_addr) : $x_prev_addr; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`prev_addr`"] = $theValue; // prev__yrs $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_prev__yrs) : $x_prev__yrs; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`prev__yrs`"] = $theValue; // phone $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_phone) : $x_phone; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`phone`"] = $theValue; // ssn $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_ssn) : $x_ssn; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`ssn`"] = $theValue; // q1 $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_q1) : $x_q1; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`q1`"] = $theValue; // q1_cmt $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_q1_cmt) : $x_q1_cmt; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`q1_cmt`"] = $theValue; // q2 $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_q2) : $x_q2; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`q2`"] = $theValue; // q2_cmt $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_q2_cmt) : $x_q2_cmt; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`q2_cmt`"] = $theValue; // q3 $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_q3) : $x_q3; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`q3`"] = $theValue; // q3_cmt $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_q3_cmt) : $x_q3_cmt; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`q3_cmt`"] = $theValue; // pres_empl $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_pres_empl) : $x_pres_empl; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`pres_empl`"] = $theValue; // pres_empl_addr $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_pres_empl_addr) : $x_pres_empl_addr; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`pres_empl_addr`"] = $theValue; // pres_empl_city $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_pres_empl_city) : $x_pres_empl_city; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`pres_empl_city`"] = $theValue; // pres_empl_phone $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_pres_empl_phone) : $x_pres_empl_phone; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`pres_empl_phone`"] = $theValue; // pres_empl_yr_st $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_pres_empl_yr_st) : $x_pres_empl_yr_st; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`pres_empl_yr_st`"] = $theValue; // pres_empl_yr_end $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_pres_empl_yr_end) : $x_pres_empl_yr_end; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`pres_empl_yr_end`"] = $theValue; // res_empl_pay_st $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_res_empl_pay_st) : $x_res_empl_pay_st; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`res_empl_pay_st`"] = $theValue; // pres_empl_pay_end $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_pres_empl_pay_end) : $x_pres_empl_pay_end; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`pres_empl_pay_end`"] = $theValue; // pres_empl_title $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_pres_empl_title) : $x_pres_empl_title; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`pres_empl_title`"] = $theValue; // pres_empl_super $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_pres_empl_super) : $x_pres_empl_super; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`pres_empl_super`"] = $theValue; // pres_empl_reason $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_pres_empl_reason) : $x_pres_empl_reason; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`pres_empl_reason`"] = $theValue; // prev_empl $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_prev_empl) : $x_prev_empl; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`prev_empl`"] = $theValue; // prev_empl_addr $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_prev_empl_addr) : $x_prev_empl_addr; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`prev_empl_addr`"] = $theValue; // prev_empl_city $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_prev_empl_city) : $x_prev_empl_city; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`prev_empl_city`"] = $theValue; // prev_empl_phone $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_prev_empl_phone) : $x_prev_empl_phone; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`prev_empl_phone`"] = $theValue; // prev_empl_yr_st $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_prev_empl_yr_st) : $x_prev_empl_yr_st; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`prev_empl_yr_st`"] = $theValue; // prev_empl_yr_end $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_prev_empl_yr_end) : $x_prev_empl_yr_end; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`prev_empl_yr_end`"] = $theValue; // prev_empl_pay_st $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_prev_empl_pay_st) : $x_prev_empl_pay_st; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`prev_empl_pay_st`"] = $theValue; // prev_empl_pay_end $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_prev_empl_pay_end) : $x_prev_empl_pay_end; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`prev_empl_pay_end`"] = $theValue; // prev_empl_title $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_prev_empl_title) : $x_prev_empl_title; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`prev_empl_title`"] = $theValue; // prev_empl_super $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_prev_empl_super) : $x_prev_empl_super; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`prev_empl_super`"] = $theValue; // prev_empl_reason $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_prev_empl_reason) : $x_prev_empl_reason; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`prev_empl_reason`"] = $theValue; // emp_gaps $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_emp_gaps) : $x_emp_gaps; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`emp_gaps`"] = $theValue; // accomplish $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_accomplish) : $x_accomplish; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`accomplish`"] = $theValue; // agree $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_agree) : $x_agree; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`agree`"] = $theValue; // signature $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_signature) : $x_signature; $theValue = ($theValue != "") ? " '" . $theValue . "'" : "NULL"; $fieldList["`signature`"] = $theValue; // date $theValue = (!get_magic_quotes_gpc()) ? addslashes($x_date) : $x_date; $theValue = ($theValue != "") ? " '" . ConvertDateToMysqlFormat($theValue) . "'" : "NULL"; $fieldList["`date`"] = $theValue; // insert into database $strsql = "INSERT INTO `NewHire` ("; $strsql .= implode(",", array_keys($fieldList)); $strsql .= ") VALUES ("; $strsql .= implode(",", array_values($fieldList)); $strsql .= ")"; mysql_query($strsql, $conn) or die(mysql_error()); mysql_close($conn); // ************* EMAIL CODE ******************* // Obtain file upload vars $fileatt = "newhireform.pdf"; $fileatt_type = "newhireform.pdf"; $fileatt_name = "newhireform.pdf"; $to = "michaelf@uniqueemployment.com"; // email address to $from = "unique@uniqueemployment.com"; // address from $subject = "New Hire Form Submitted"; $message = "New Hire Form Submitted by: ".$x_name; $headers = "From: $from"; // Read the file to be attached ('rb' = read binary) $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); // Generate a boundary string $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // Add the headers for a file attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; // Add a multipart boundary above the plain message $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; // Base64 encode the file data $data = chunk_split(base64_encode($data)); // Add file attachment to the message $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; // Send the message $ok = @mail($to, $subject, $message, $headers); // ************* END EMAIL CODE ******************* ob_end_clean(); header("Location: thankyou.php"); } ?>
|
|