array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'fdf.examples.php', 1 => '示例', ), 'up' => array ( 0 => 'book.fdf.php', 1 => 'FDF', ), 'prev' => array ( 0 => 'fdf.constants.php', 1 => '预定义常量', ), 'next' => array ( 0 => 'ref.fdf.php', 1 => 'FDF 函数', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/fdf/examples.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
The following examples shows just the evaluation of form data.
示例 #1 Evaluating a FDF document
<?php
// Open fdf from input string provided by the extension
// The pdf form contained several input text fields with the names
// volume, date, comment, publisher, preparer, and two checkboxes
// show_publisher and show_preparer.
$fdf = fdf_open_string($HTTP_FDF_DATA);
$volume = fdf_get_value($fdf, "volume");
echo "The volume field has the value '<b>$volume</b>'<br />";
$date = fdf_get_value($fdf, "date");
echo "The date field has the value '<b>$date</b>'<br />";
$comment = fdf_get_value($fdf, "comment");
echo "The comment field has the value '<b>$comment</b>'<br />";
if (fdf_get_value($fdf, "show_publisher") == "On") {
$publisher = fdf_get_value($fdf, "publisher");
echo "The publisher field has the value '<b>$publisher</b>'<br />";
} else
echo "Publisher shall not be shown.<br />";
if (fdf_get_value($fdf, "show_preparer") == "On") {
$preparer = fdf_get_value($fdf, "preparer");
echo "The preparer field has the value '<b>$preparer</b>'<br />";
} else
echo "Preparer shall not be shown.<br />";
fdf_close($fdf);
?>