We use this code to dump everything into pdf using Acorbat 5.0
Everything works fine except for the checkbox.
//**********
// IF Statement
//**********
if($ps=="genPDF") {
$url="..Digital_Forms/dforms/Matthews/Monthly_Pay_Plan_Arrangement.pdf";
$values=$HTTP_POST_VARS;
$fdfdata = "%FDF-1.2\n%‚„œ”\n";
$fdfdata .= "1 0 obj \n<< /FDF ";
$fdfdata .= "<< /Fields [\n";
//loop that adds the field names and values
foreach($values as $key=>$val)
{
$fdfdata.="<< /V ($val)/T ($key) >> ";
}
$fdfdata .= "]\n";
$fdfdata .= "/F ($url) >>";
$fdfdata .= ">>\nendobj\ntrailer\n<<\n/Root 1 0
R\n>>\n";
$fdfdata .= "%%EOF";
/*** Now we display the FDF data which causes Acrobat to start ***/
header ("Content-Type: application/vnd.fdf");
print $fdfdata;
}else if($ps!="post"){
//**************
// Writting Info
//**************
echo "<b>". $formName. "</b> - ". $formSubject;
}else{
//******************************
// Writting Form for Information
//******************************
global $cookie, $dbi;
$userName = $cookie[1];
$userID = $cookie[0];
$result = sql_query("select nuke_locations.locID,
nuke_locations.locName,
nuke_locations.locAddress1,
nuke_locations.locAddress2,
nuke_locations.locCity,
nuke_locations.locState,
nuke_locations.locZip,
nuke_locations.locPhone,
nuke_locations.locFax,
nuke_departments.dID,
nuke_departments.dLongName,
nuke_departments.dFax,
nuke_users_personal_profile.appFirstName,
nuke_users_personal_profile.appLastName,
nuke_users_personal_profile.appCallName
from nuke_locations,
nuke_departments,
nuke_users_personal_profile,
nuke_users_company_profile
where
nuke_users_company_profile.acpID = $userID and
nuke_users_personal_profile.appID = nuke_users_company_profile.acpID and
nuke_locations.locID = nuke_users_company_profile.acpLocID and
nuke_departments.dID = nuke_users_company_profile.acpDeptID", $dbi);
if(!$result) { echo "Error getting results"; }
list($locID, $locName, $locAddress1, $locAddress2, $locCity, $locState, $locZip, $locPhone, $locFax, $dID, $dLongName, $dFax, $appFirstName, $appLastName, $appCallName) = sql_fetch_row($result, $dbi);
if ($appCallName == "") {
$fullName = $appFirstName. " ". $appLastName;
} else {
$fullName = $appCallName. " ". $appLastName;
}
if ($locAddress2 == "") {
$LocationAddress = $locAddress1;
} else {
$LocationAdress = $locAddress1. ", ". $locAddress2;
}
$LocationCSZ = $locCity. ", ". $locState. " ". $locZip;
$locPhone1 = $locPhone;
$locPhone2 = $locPhone;
$areacode = substr($locPhone, 0, 3);
$prefix = substr($locPhone, 3, 3);
$suffix = substr($locPhone, 6, 4);
$locPhone = "($areacode) $prefix-$suffix";
OpenTable();
echo "<b>". $formName. "</b> (rev: ". $formRevisionNumber. ")<hr>";
echo ("<form method=\"post\" action=\"..Digital_Forms/dforms/Matthews/Monthly_Pay_Plan_Arrangement.php\">
<input type=\"hidden\" name=\"ps\" value=\"genPDF\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td>Patient Name:</td>
<td><input type=\"text\" size=\"30\" name=\"pdfPname\"></td>
</tr>
<tr>
<td>Patient Address:</td>
<td><input type=\"text\"size=\"30\" name=\"pdfPadd\"></td>
</tr>
<tr>
<td>/City:</td>
<td><input type=\"text\" size=\"30\" name=\"pdfCity\"></td>
</tr>
<tr>
<td>State: </td>
<td><input type=\"text=\" size=\"30\" name=\"pdfState\"></td>
</tr>
<tr>
<td>Zip: </td>
<td><input type=\"text\" name=\"pdfZip\" size=\"30\"></td>
</tr>
<tr>
<td>Patient Phone#: </td>
<td><input type=\"text\" name=\"pdfPphone\" size=\"30\"></td>
</tr>
<tr>
<td>Next of Kin: </td>
<td><input type=\"text\" name=\"pdfKin\" size=\"30\"></td>
</tr>
<tr>
<td>Phone#: </td>
<td><input type=\"text\" name=\"pdfKphone\" size=\"30\"></td>
</tr>
<tr>
<td>Amount of Monthly Payment: </td>
<td><input type=\"text\" name=\"pdfPay\" size=\"30\"></td>
</tr>
<tr>
<td>Day of the Month: </td>
<td><input type=\"text\" name=\"pdfDue\" size=\"30\"></td>
</tr>
<tr>
<td>Remarks: </td>
<td><input type=\"text\" name=\"pdfRemark\" size=\"30\"></td>
</tr>
<tr>
<td>Signature of Patient or Responible Party: </td>
<td><input type=\"text\" name=\"pdfPsign\" size=\"30\"></td>
</tr>
<tr>
<td>Date Signed: </td>
<td><input type=\"text\" name=\"pdfDate\" size=\"30\"></td>
</tr>
<tr>
<td>Signature of Clinic's Financial Counselor: </td>
<td><input type=\"text\" name=\"pdfCsign\" size=\"30\"></td>
</tr>
<tr>
<td>Date Signed: </td>
<td><input type=\"text\" name=\"pdfDsign\" size=\"30\"></td>
</tr>
<td>Account#: </td>
<td><input type=\"text\" name=\"pdfAcct\" size=\"30\"></td>
</tr>
<tr>
<td>In Office: </td>
<td><input type=\"checkbox\" checked name=\"pdfOffice\" size=\"3\"
value=\"true\"></td>
</tr>
<tr>
<td>Over Telephone: </td>
<td><input type=\"checkbox\" checked name=\"pdfPhone\" size=\"3\"
value=\"true\"></td>
</tr>
<tr>
<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"Submit\"></td>
</tr>
</table></form>
");
CloseTable();
}
?>