#native_company# #native_desc#

FDF Support in PHP Page 3

By Uwe Steinmann
on November 16, 2000

In order to make this clearer, a simple example is provided. First, assume we have a
form containing the fields volume, publisher, preparer, date, comment
show_publisher, show_preparer
The first five fields are text input fields; the last two are check boxes.
Our PHP script shall always display the values of the fields volume, date,
, but display the value of the fields publisher and preparer
only if the corresponding check boxes are checked. If the boxes are checked, their
value is “On” since it was preset when the form was created. And of course the
form also has a submit button, in our case it even has a reset button.
Hitting the submit button runs the following script. This script evaluates the
field data as described above.


   $fdffp fopen("test.fdf""w");



   $fdf fdf_open("test.fdf");

$volume fdf_get_value($fdf"volume");

"The volume field has the value '<B>$volume</B>'<BR>";

   $date fdf_get_value($fdf"date");

"The date field has the value '<B>$date</B>'<BR>";

   $comment fdf_get_value($fdf"comment");

"The comment field has the value '<B>$comment</B>'<BR>";

   if(fdf_get_value($fdf"show_publisher") == "On") {

$publisher fdf_get_value($fdf"publisher");

"The publisher field has the value '<B>$publisher</B>'<BR>";

   } else

"Publisher shall not be shown.<BR>";

   if(fdf_get_value($fdf"show_preparer") == "On") {

$preparer fdf_get_value($fdf"preparer");

"The preparer field has the value '<B>$preparer</B>'<BR>";

   } else

"Preparer shall not be shown.<BR>";