I have developed a PDF Form my company uses to keep track of mileage expenses. When the user is finished, the user submits the document by clicking a button. Once submitted, it posts to a php web page and writes the field information to a MySQL Database. This is great and all, but we are required to have users sign the document using a PDF electronic signature field. I cannot get the signature to post, or write to the database. The field name is signature. Any assistance would be great.
The code is below (without the signature):
<?php
include_once('../php/functions.php');
$sig_month = $_POST['sig_month'];
$sig_day = $_POST['sig_day'];
$sig_year = $_POST['sig_year'];
$mileage_rate = $_POST['mileage_rate'];
$form_id = $_POST['form_id'];
$submission_date = $_POST['submission_date'];
$signed = $_POST['signed'];
$employee_name = $_POST['employee_name'];
if(strlen($sig_month) == 1){
$sig_month = "0".$sig_month;
}
if(strlen($sig_day) == 1){
$sig_day = "0".$sig_day;
}
$employee_initial = $employee_name[0];
$employee_explode = explode(" ", $employee_name);
$employee_email = $employee_initial . $employee_explode[1];
$employee_email = strtolower($employee_email) . "@fbhi.net";
$mileage_rate = "0.".$mileage_rate;
$query="SELECT * FROM employee WHERE email = '$employee_email'";
$ifExists = ifExists($query,$db_con);
if($ifExists > 0){
$result = queryMysqli($query,$db_con);
while($row = mysqli_fetch_array($result)){
$employee_name = $row['first_name'] . " " . $row['last_name'];
$error = 0;
$success = 0;
$x = 1;
$query1 = "DELETE FROM mileage_form WHERE form_id = '$form_id'";
if(!queryMysqli($query1,$db_con)){
$error++;
}
while($x < 8){
$month = $_POST['month_day'.$x];
$day = $_POST['day_day'.$x];
$year = $_POST['year_day'.$x];
$purpose = $_POST['purpose_day'.$x];
$miles = $_POST['miles_day'.$x];
if(strlen($month) == 1){
$month = "0".$month;
}
if(strlen($day) == 1){
$day = "0".$day;
}
if($employee_name != "" && $mileage_rate != "" && $month != "" && $day != "" && $year != "" && $purpose != "" && $miles != "" && $form_id != "" && $submission_date != "" && $sig_month != "" && $sig_day != "" && $sig_year != "" && $signed == "t"){
$query = "INSERT INTO mileage_form (employee_name,mileage_rate,month,day,year,purpose,miles,sig_month,sig_day,sig_year,submission_date,signed,form_id)
VALUES ('$employee_name','$mileage_rate','$month','$day','$year','$purpose','$miles','$sig_month','$sig_day','$sig_year','$submission_date','$signed','$form_id')";
if(!queryMysqli($query,$db_con)){
$error++;
}else{
$success++;
}
}
$x++;
}
if($error != 0){
echo "Something went wrong! Your mileage claims did not submit!";
}
if($success != 0){
echo "<center>Mileage claims have been submitted for <br /><font size=6><strong>$employee_email</strong/></font><br />If this is not the correct email, contact your IT Administrator immediately!";
}else{
echo "Your mileage form is incomplete. Ensure all of the required information is finished, and then resubmit your form.";
}
}
}else{
echo "<center>Sorry, your email is not registered in our database. If you are positive your email is $employee_email, please contact your IT Administrator";
}
?>