note 9389 added to Forms Data Format functions

From: Date: Tue, 31 Oct 2000 18:09:42 +0000
Subject: note 9389 added to Forms Data Format functions
Groups: php.notes 
Request: Send a blank email to php-notes+get-7215@lists.php.net to get a copy of this message
If you simply want to create PDF forms that you can have users fill out and submit, (ie: you have no need of parsing the data, you only want to be able to recall the form all nicely filled out) then a combination of the methods above work nicely: 1) create PDF form with fields and a submit button that submits to your PHP script in FDF format. 2) create your submission PHP script. the guts of the one i made was essentially this: <?php // Save the FDF data into a file $thefilename = "pdf" . time(void) . ".fdf"; $fdffp = fopen("$picdir/$thefilename", "w"); fwrite($fdffp, $HTTP_RAW_POST_DATA, strlen($HTTP_RAW_POST_DATA)); fclose($fdffp); $content = "Saved form data at: $picurl/$thefilename\n"; $mail=popen ("/usr/sbin/sendmail -t","w") ; fputs ($mail,"To: $recipient\n") ; fputs ($mail,"From: $recipient\n") ; fputs ($mail,"Subject: $subject\n\n") ; fputs ($mail,$content) ; pclose ($mail) ; echo "Saved form data to: $picurl/$thefilename!<br>"; ?> 3) the script above saves the entire FDF file to a directory on the webserver (this directory must be writable by the webserver of course), and emails a notice to $recipient reporting the URL to the file. The FDF file is saved with a timestamp as part of the name. This is only a slight variation of scripts mentioned above, but suits a very simple purpose very nicely and avoids the obvious insecurities of sending the FDF over the user's email client via the "Mailto:" method mentioned in Adobe's docs. http://www.php.net/manual/ref.fdf.php

« previous php.notes (#7215) next »