Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).


New Forum | Previous | Next | (P-PDF) Developers


Topic: Save Field data to mySQL
Conf: (P-PDF) Developers, Msg: 137715
From: mbair
Date: 8/11/2005 05:38 AM

I would like to save pdf form fields to a mySQL database using php. I figure on the pdf I will put a submit button, which submits the form data to a separate php script. I do not know what to do with it from there though.

I am fairly farmiliar with php, and I know how to insert data into mySQL and all that. I guess the problem I am having is I do not know how to get the field data from the form, to a string which I can work with in php.

Any help would be appreciated.

Thanks,
Matt

I have filled pdf forms from a database, using a variation of this sample code:


// the full http path to the PDF form
$form = 'http://my_domain.com/my_pdf_form.pdf';

function create_fdf ($pdffile, $strings, $keys)
{
$fdf = "%FDF-1.2\n%????\n";
$fdf .= "1 0 obj \n<< /FDF << /Fields [\n";

foreach ($strings as $key => $value)
{
$key = addcslashes($key, "\n\r\t\\()");
$value = addcslashes($value, "\n\r\t\\()");
$fdf .= "<< /T ($key) /V ($value) >> \n";
}
foreach ($keys as $key => $value)
{
$key = addcslashes($key, "\n\r\t\\()");
$fdf .= "<< /T ($key) /V /$value >> \n";
}

$fdf .= "]\n/F ($pdffile) >>";
$fdf .= ">>\nendobj\ntrailer\n<<\n";
$fdf .= "/Root 1 0 R \n\n>>\n";
$fdf .= "%%EOF";

return $fdf;
}

// Fill in text fields
$strings = array(
'date' => '10/17/2004',
'full_name' => 'Joe Doe',
'phone_num' => '123-4567',
'company' => 'ACME Widgets',
'amount' => 'USD 100.00'
);

// Fill in check boxes/radio buttons
$keys = array('
gender' => 'male',//radio button
'is_adult' => 'Off',//checkbox
'urgent' => 'On'//checkbox
);

// Output the PDF form, with form data filled-in
header('Content-type: application/vnd.fdf');
echo create_fdf($form, $strings, $keys);

?>


PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
Platinum Sponsor





Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.