LonghornPHP 2026

Voting

: min(eight, five)?
(Example: nine)

The Note You're Voting On

joe at koontz dot net
26 years ago
The simplest thing to do is get the FDF data from $HTTP_RAW_POST_DATA.  (unless you have the server library installed none of the fdf data gets parsed!) This is typical of  what you get:
%FDF-1.2
1 0 obj
<< 
/FDF << /Fields [ << /V (0)/T (amount0)>> << /V (0)/T (amount1)>> << /V (0)/T (amount2)>> 
<< /V (0)/T (amount3)>> << /V (0)/T (amount4)>> << /V (0)/T (amount5)>> 
<< /V (0)/T (amount6)>> << /V (0)/T (amount7)>> << /V (0)/T (amount8)>> 
<< /V (0)/T (amount9)>> << /V /0102 /T (chase_bk)>> << /V (0)/T (count)>> 
<< /V (0)/T (invtotal)>> << /V (12/21/2000)/T (sent_ap)>> << /V /Off /T (spec_hand)>> 
<< /V (041232)/T (transit_no)>> << /V (THIS FORM IS NOT COMPLETE!!!)/T (X)>> 
] 
/F (http://x.com/forms/AA00390q.pdf)>> 
>> 
endobj
trailer
<<
/Root 1 0 R 

>>
%%EOF
kill everything before the [ and then parse it down into key value pairs.  
I wrote this to create an FDF, make sure you do a 
header("Content-type: application/vnd.fdf");
before you echo the returned value to the user.

<?php
function FDFput($FDFpage){
 $A = "%FDF-1.2\n1 0 obj\n<< \n/FDF << /Fields [ \n";
 $C = " ] \n"    ;
     if ($FDFpage>"" ) {$C .=" /F ($FDFpage)>>\n";}
    $C .= ">>\n>> \nendobj\ntrailer\n\n<</Root 1 0 R>>\n%%EOF\n";
    $B = "";
 reset($FDFData);
 while (list($key, $val) = each($FDFData))
  {
  if (strlen(trim($val)) > 0 && is_string($key))
   {
    $B .= "<</T ($key) /V (". $val . ")>>\n";
//echo     "<</T ($key) /V (". $val . ")>>\n";
                }
  }
    return $A.$B.$C;
}
?>
 
It ain't perfect - but it works. (I use HTML for posting to the server, FDF to the browser)
joe

<< Back to user notes page

To Top