Women in Technology

Hear us Roar



Article:
  PHP Form Handling
Subject:   Unable to get form to work
Date:   2007-10-17 11:31:58
From:   jlbecker
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html style="direction: ltr;"
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1" />
<title>Employee Access Request Form</title>
<style type="text/css">
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-size: small;
}
.style2 {font-family: Arial, Helvetica, sans-serif}
.style3 {}
.style5 {font-family: Arial, Helvetica, sans-serif; color: #FFFFFF; }
.style6 {color: #FFFFFF}
.style7 {
font-size: x-small;
font-style: italic;
}
.style8 {font-size: x-small}
.style9 {font-size: large}
-->
</style>
</head>
<body
style="color: rgb(0, 0, 0); background-color: rgb(204, 204, 204);"
alink="#000099" link="#000099" vlink="#990099">
<form action="formsend.php" method="post">
<table border="0" cellpadding="0" cellspacing="0"
width="100%">
<tbody>
<tr>
<td>
<table border="0" cellpadding="1"
cellspacing="1" width="100%">
<tbody>
<tr>
<td>
<div align="center">
<h1 class="style2">Employee Access Request
Form </h1>
</div>
</td>
</tr>
<tr>
<td>
<div class="style1" align="center">Fill
out top 3 sections and hit submit button. Please allow adequate time
for completion. </div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>


<table style="width: 100%; height: 68px;" bgcolor="#000000"
border="0" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td>
<div class="style2" align="center">
<h2 class="style6">Employee Information </h2>
</div>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%;" border="0"
cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td style="width: 33%;">
<div class="style3" align="center">

<input name="New_Employee"
value="checkbox" type="checkbox" /> New Employee


</div>
</td>
<td width="34%">
<div align="center">

<input
name="Change_Employee" value="checkbox" type="checkbox" />Change
Employee


</div>
</td>
<td width="33%">
<div align="center"> <input
name="Delete_Employee" value="checkbox" type="checkbox" /><span
class="style2">Delete Employee</span> </div>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="1" cellspacing="1"
width="100%">
<tbody>
<tr>
<td width="40%"><span class="style2">First
Name: <input name="First_Name" size="50" type="text" />
</span></td>
<td width="20%"><span class="style2">M.I.</span>:
<input name="Middle_Initial" size="5"
maxlength="1" type="text" /></td>
<td width="40%"><span class="style2">Last
Name:</span> <input name="Last_Name" size="50"
type="text" /></td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="1" cellspacing="1"
width="100%">
<tbody>
<tr>
<td width="50%"><span class="style2">Internal
Phone: <input name="Internal_Phone" type="text" />
</span></td>
<td width="50%"><span class="style2">Start
Date: <input name="Start_Date" type="text" /> </span></td>
</tr>
<tr>
<td><span class="style2">Public Phone: <input
name="Public_Phone" type="text" /> </span></td>
<td><span class="style2">Title</span>:
<input name="Title" type="text" /></td>
</tr>
<tr>
<td><span class="style2">Department</span>:
<input name="Department" type="text" /></td>
<td><span class="style2">Location</span>:
<input name="Location" type="text" /></td>
</tr>
<tr>
<td><span class="style2">Voice Mail: <input
name="Voice_Mail_Yes" value="checkbox" type="checkbox" />
Yes     <input name="Voice_Mail_No"
value="checkbox" type="checkbox" /> No</span></td>
<td><span class="style2">Immediate
Supervisor: <input name="Immediate_Supervisor" type="text" />
</span></td>
</tr>
</tbody>
</table>
<table style="width: 100%; height: 82px;" border="0"
cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td style="vertical-align: top;"><span
class="style2">Additional
Information: <textarea name="Additional_Information"
cols="100"></textarea> </span></td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="1" cellspacing="1"
width="100%">
<tbody>
<tr>
<td> </td>
</tr>
</tbody>
</table>
<table bgcolor="#000000" border="0" cellpadding="1"
cellspacing="1" width="100%">
<tbody>
<tr>
<td>
<div class="style5" align="center">
<h2 class="style2">Type of Access Needed </h2>
</div>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%;" border="0"
cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td style="width: 8%; vertical-align: top;"><input
name="Email_Yes" value="checkbox" type="checkbox" />
<span class="style2">Email </span></td>
<td style="width: 44%; vertical-align: top;"><span
class="style2">Distribution
Lists: <input name="Distribution_Lists" size="50"
type="text" /> </span></td>
<td style="width: 18%; vertical-align: top;"><input
name="FullCourt_Yes" value="checkbox" type="checkbox" />
<span class="style2">FullCourt*</span></td>
<td style="width: 21%; vertical-align: top;"><span
class="style2"> <input name="PICS_n_KICS_Yes"
value="checkbox" type="checkbox" /> PICS-n-KICS* <span
class="style7">(the
ability to view images through FullCourt)</span></span></td>
<td style="width: 9%; vertical-align: top;"><input
name="SAP_Yes" value="checkbox" type="checkbox" />
<span class="style2">SAP</span> </td>
</tr>
</tbody>
</table>
<table style="width: 100%;" border="0"
cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td style="width: 26%; vertical-align: top;"><span
class="style2"> <input name="Work_Folders_Yes"
value="checkbox" type="checkbox" /> Ability to work
Imaging Folders </span></td>
<td style="width: 34%; vertical-align: top;"><span
class="style2">If so, for which libraries: <input
name="CV_Yes" value="checkbox" type="checkbox" />
CV   <input name="CR_Yes" value="checkbox"
type="checkbox" /> CR   <input
name="JV_Yes" value="checkbox" type="checkbox" />
JV   <input name="CT_Yes" value="checkbox"
type="checkbox" /> CT </span></td>
<td style="width: 40%; vertical-align: top;"><span
class="style2"> <input name="Attorney_Label_Program_Yes"
value="checkbox" type="checkbox" /> Attorney Label
Program    <input name="Label_Printer_Yes"
value="checkbox" type="checkbox" /> Label Printer </span></td>
</tr>
</tbody>
</table>
<table style="width: 100%;" border="0"
cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td style="vertical-align: top;"><span
class="style2"> <input name="I_Leads_Yes"
value="checkbox" type="checkbox" />I-Leads <span
class="style8">(These two forms, Sheriff Security Access Awareness Statement (http://dcinfo/info/polform/awareness_statement.pdf)
& Sedgwick County Non-Employee Information
Technology Usage Agreement (http://dcinfo/info/polform/Sedgwick%20County%20Non-Employee%20Information%20Technology%20Usage%20Agreement.doc) , need to be signed and faxe to
Eric Laney at 383-7600. This form, Sheriff
Security Access Request (http://dcinfo/info/polform/background.doc) , needs to be filled out and sent back
to us as an attachment.) </span></span></td>
</tr>
<tr>
<td style="vertical-align: top;"><span
class="style2"> <input name="Quash_Warrants_Yes"
value="checkbox" type="checkbox" /> Ability to
MANUALLY Quash warrants in
I-Leads </span></td>
</tr>
<tr>
<td style="vertical-align: top;"><span
class="style2"> <input name="checkbox18"
value="checkbox" type="checkbox" />E-Justice <span
class="style8">(This form, Sheriff
Security Access Request (http://dcinfo/info/polform/background.doc) , needs to be filled out and sent back
to us as an attachment. This form, City Access Form (http://dcinfo/info/polform/Non-City%20SNP%20Access%20Form_Agree.doc) , needs to be
filled out and e-mailed to Satin Siroky (ssiroky@wichita.gov) or faxed
(858-7704) to start the process but signed originals must be mailed per
the directions on the SNP form. The original documents will need to be
submitted to the City's IT/IS Department M/S, Satin Siroky) </span></span></td>
</tr>
</tbody>
</table>
<table style="width: 100%;" border="0"
cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td style="width: 19%; vertical-align: top;"><span
class="style2"> <input name="CICS_Yes"
value="checkbox" type="checkbox" /> CICS (mainframe) </span></td>
<td style="width: 81%; vertical-align: top;"><span
class="style2">Access
equal to: <input name="Access_egual_to" type="text" />
</span></td>
</tr>
</tbody>
</table>
<table style="width: 919px; height: 77px;" border="0"
cellpadding="1" cellspacing="1">
<tbody>
<tr>
<td
style="width: 20%; vertical-align: top; font-family: Helvetica,Arial,sans-serif; text-align: left; height: 75px;">Additional
Information:</td>
<td style="width: 80%; vertical-align: middle; height: 75px;">
<span class="style2"> <textarea
rows="3" cols="100" name="Additional_Information"></textarea>
</span></td>
</tr>
</tbody>
</table>
<table
style="font-family: Helvetica,Arial,sans-serif; font-style: italic; width: 100%; height: 62px;"
class="style2 style8" border="0" cellpadding="1"
cellspacing="1">
<tbody>
<tr>
<td style="vertical-align: top;"> * <span
style="font-size: 8pt;">For FullCourt orientation, please
contact dcithelp@dc18.org (mailto:dcithelp@dc18.org)
for availability and
dates.</span></td>
</tr>
</tbody>
</table>
<table bgcolor="#000000" border="0" cellpadding="1"
cellspacing="1" width="100%">
<tbody>
<tr>
<td>
<h2 align="center"><span class="style5">Requesting
Supervisor or Manager </span></h2>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="1" cellspacing="1"
width="100%">
<tbody>
<tr>
<td width="34%"><span class="style2">Name</span>:
<input name="Requesting_Name" type="text" /></td>
<td width="33%"><span class="style2">Phone</span>:
<input name="Requesting_Phone" type="text" /></td>
<td width="33%"><span class="style2">Date</span>:
<input name="Requesting_Date" type="text" /></td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="1" cellspacing="1"
width="100%">
<tbody>
<tr>
<td> </td>
</tr>
</tbody>
</table>
<table bgcolor="#000000" border="0" cellpadding="1"
cellspacing="1" width="100%">
<tbody>
<tr>
<td>
<div class="style2" align="center">
<h2 class="style6">DCIT USE ONLY - DO NOT WRITE
BELOW THIS LINE </h2>
</div>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="1" cellspacing="1"
width="100%">
<tbody>
<tr>
<td width="50%"><span class="style2">County
UserID: <input name="County_UserID" type="text" />
</span></td>
<td width="51%"><span class="style2">Date
SAR Submitted: <input name="SAR_Submitted" type="text" />
</span></td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="1" cellspacing="1"
width="100%">
<tbody>
<tr>
<td height="178">
<table border="0" cellpadding="1"
cellspacing="1" width="100%">
<tbody>
<tr>
<td valign="top" width="8%">
<div align="top"><span class="style2">Notes</span>:</div>
</td>
<td width="92%"><textarea name="Notes"
cols="100" rows="10"></textarea></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="1" cellspacing="1"
width="100%">
<tbody>
<tr>
<td>
<div class="style9" align="center"> <input
name="Submit" class="style9" value="Submit"
type="submit" /> </div>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>


I am using the following processing script


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>


<body>
<?


if ((!$First_Name) || (!$Middle_Initial) || (!$Last_Name) || (!$Internal_Phone) || (!$Public_Phone) || (!$Title) || (!$Department) || (!$Location) || (!$Immediate_Supervisor) || (!$Requesting_name) || (!$Requesting_Phone) || (!$Requesting_Date))
{
$display .= '<p align="center">All fields are required. Please check your information and try again.

';
$display .= '

Go back (javascript:history.back())

';


}
else{


$New_Employee = $_POST['New_Employee'];
$Change_Employee = $_POST['Change_Employee'];
$Delete_Employee = $_POST['Delete_Employee'];
$First_Name = $_POST['First_Name'];
$Middle_Initial = $_POST['Middle_Initial'];
$Last_Name = $_POST['Last_Name'];
$Internal_Phone = $_POST['Internal_Phone'];
$Public_Phone = $_POST['Public_Phone'];
$Title = $_POST['Title'];
$Department = $_POST['Department'];
$Location = $_POST['Location'];
$Voice_Mail_Yes = $_POST['Voice_Mail_Yes'];
$Voice_Mail_No = $_POST['Voice_Mail_No'];
$Immediate_Supervisor = $_POST['Immediate_Supervisor'];
$Additional_Information = $_POST['Additional_Information'];
$Email_Yes = $_POST['Email_Yes'];
$Distribution_Lists = $_POST['Distribution_Lists'];
$FullCourt_Yes = $_POST['FullCourt_Yes'];
$PICS_n_KICS_Yes = $_POST['PICS_n_KICS_Yes'];
$SAP_Yes = $_POST['SAP_Yes'];
$Work_Folders_Yes = $_POST['Work_Folders_Yes'];
$CV_Yes = $_POST['CV_Yes'];
$CR_Yes = $_POST['CR_Yes'];
$JV_Yes = $_POST['JV_Yes'];
$CT_Yes = $_POST['CT_Yes'];
$Attorney_Label_Program_Yes = $_POST['Attorney_Label_Program_Yes'];
$Label_Printer_Yes = $_POST['Label_Printer_Yes'];
$I_Leads_Yes = $_POST['I_Leads_Yes'];
$Quash_Warrants_Yes = $_POST['Quash_Warrants_Yes'];
$E_Justice_Yes = $_POST['E_Justice_Yes'];
$CICS_Yes = $_POST['CICS_Yes'];
$Access_equal_to = $_POST['Access_equal_to'];
$Additional_information = $_POST['Additional_information'];
$Requesting_name = $_POST['Requesting_name'];
$Requesting_Phone = $_POST['Requesting_Phone'];
$Requesting_Date = $_POST['Requesting_Date'];



//Send form results to file
//$fp = fopen("formresults.txt", "a");
//fwrite($fp, $name . "," .
// $email . "," .
// $comments . "," .
// date("M-d-Y") . "\n");
//fclose($fp);


// send form results through email
$recipient = "jbecker@dc18.org";
$subject = "Employee:"; "$First_Name"; "$Last_Name";
$forminfo =
(
"Employee Information: \r".
$New_Employee . "\r" .
$Change_Employee . "\r" .
$Delete_Employee . "\r" .
$First_Name . "\r" .
$Middle_Initial . "\r" .
$Last_Name . "\r" .
$Internal_Phone . "\r" .
$Public_Phone . "\r" .
$Title . "\r" .
$Department . "\r" .
$Location . "\r" .
$Voice_Mail_Yes . "\r" .
$Voice_Mail_No . "\r" .
$Immediate_Supervisor . "\r" .
$Additional_Information . "\r\r" .



"Type of Access Needed: \r".
Email_Yes . "\r" .
$Distribution_Lists . "\r" .
$FullCourt_Yes . "\r" .
$PICS_n_KICS_Yes . "\r" .
$SAP_Yes . "\r" .
$Work_Folders_Yes . "\r" .
$CV_Yes . "\r" .
$CR_Yes . "\r" .
$JV_Yes . "\r" .
$CT_Yes . "\r" .
$Attorney_Label_Program_Yes . "\r" .
$Label_Printer_Yes . "\r" .
$I_Leads_Yes . "\r" .
$Quash_Warrants_Yes . "\r" .
$E_Justice_Yes . "\r" .
$CICS_Yes . "\r" .
$Access_equal_to . "\r" .
$Additional_information . "\r\r" .



"Requesting Supervisor or Manager: \r".
$Requesting_name . "\r" .
$Requesting_Phone . "\r" .
$Requesting_Date . "\r" .


);


$formsend = mail("$recipient", "$subject", "$forminfo", "From: $email\r\nReply-to:$email\r\n");
$display .= '

Thank you. You have successfully submitted the following information:

';
$display .= nl2br($forminfo);
}


?>
<? echo $display; ?>
</body>
</html>