code works with IE but not FF ... sort of
Posted: Tue May 03, 2011 3:40 pm
i am using the code below, and there is a 4th file that is the PDF template the FDF data is supposed to merge into (not included here)
in firefox server A works but server b does not
i explorer, however, they both work (render the pdf file on screen at the last instead of just the fdf dta file)
if you can tell me how to make this work for both servers in Firefox that would be very helpful
I have simplified the code on the initial form page, and show the code on the other pages.
Form:
file 2 ... this is the file that creates the fdf file createFDF.php
last, this is the file that processes the form request ... modprocess.php, and is somehow used to join the fdf to the pdf:
in firefox server A works but server b does not
i explorer, however, they both work (render the pdf file on screen at the last instead of just the fdf dta file)
if you can tell me how to make this work for both servers in Firefox that would be very helpful
I have simplified the code on the initial form page, and show the code on the other pages.
Form:
Code: Select all
<?php
include dirname<__FILE__>.'/mod_process.php';
echo '<?xml version="1.0" encoding="iso-8859-1"?>',"\n"; // because short_open_tags = On causes a parse error.
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body bgcolor="#FFFFFF" onload__="MM_preloadImages<'textA.gif','closeB.jpg','closeA.jpg'>;checkFreeForm<document.getElementById<'agent_name'>>;" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">
<div id="application">
<?php
if<isset<$CREATED>>{
?>
<span class="style4">
<h1>Your Result</h1>
<p><a href="<?php echo str_replace<dirname<__FILE__>.'/','',$fdf_file> ?>">Click here to create forms package.</a> </p>
</span>
<?php
}
?>
<form method="POST" autocomplete="on" NAME="smartform" target="_parent" action="<?php echo $_SERVER['REQUEST_URI'] ?>" onsubmit__="return Validator<smartform>; clickedButton"><a NAME="tab1"></a>
<center>
<center>
<table BORDER=1 CELLSPACING=0 CELLPADDING=0 WIDTH="620" bordercolor="#003399" >
<tr>
<td bgcolor="#7C96A5">
<center>
<a NAME="tab7"></a><span class="style2"><b>BORROWER INFORMATION</b></span>
</center>
</td>
</tr>
</table>
<table border=0 width="620" align="center" >
<tr>
<td width="51">
<td width="112"> </td>
<td width="221"><span class="style4"><b> Borrower</b></span></td>
<td width="222"><span class="style4"><b> Co-Borrower</b></span></td>
</tr>
<tr>
<td width="51">
</td>
<td width="112" bgcolor="#E8EBEE">
<div align=right><span class="style4">First Name: </span></div>
</td>
<td width="221" bgcolor="#F7F7F7"> <span class="style4">
<input class="left" onblur__="mark<this,'#ffffff','#000000'>" name="b_fname" size="20" maxlength="40" onfocus__="nextfield ='cb_fname'; mark<this,'#FFFF99','#0000FF'>">
</span> </td>
<td width="222" bgcolor="#E8EBEE"> <span class="style4">
<input class="left" onblur__="mark<this,'#ffffff','#000000'>" name="cb_fname" size="20" maxlength="40" onfocus__="nextfield ='b_lname'; mark<this,'#FFFF99','#0000FF'>">
</span> </td>
</tr>
</tr>
</table>
<center>
Submission Date: <input type="date" name="creation_date" size="10">
<p><input TYPE="submit" name="submit" value="Submit" onclick__="clickedButton=true">
</center>
<p>
<p>
<input type="hidden" name="MM_insert" value="smartform">
</form>
<table width="620" border="0" cellspacing="2" cellpadding="0" align="center">
</table>
</div>
</body>
</html>
Code: Select all
<?php
function createFDF($file,$info){
$data="%FDF-1.2\n%âãÏÓ\n1 0 obj\n<< \n/FDF << /Fields [ ";
foreach($info as $field => $val){
if(is_array($val)){
$data.='<</T('.$field.')/V[';
foreach($val as $opt)
$data.='('.trim($opt).')';
$data.=']>>';
}else{
$data.='<</T('.$field.')/V('.trim($val).')>>';
}
}
$data.="] \n/F (".$file.") /ID [ <".md5(time()).">\n] >>".
" \n>> \nendobj\ntrailer\n".
"<<\n/Root 1 0 R \n\n>>\n%%EOF\n";
return $data;
}
?>
last, this is the file that processes the form request ... modprocess.php, and is somehow used to join the fdf to the pdf:
Code: Select all
<?php
require_once 'createFDF.php';
$pdf_file='http://www.americanlaw1.com/apdf/v12.pdf';
// allow for up to 25 different files to be created, based on the minute
$min=date('i') % 25;
$fdf_file=dirname(__FILE__).'/results/posted-'.$min.'.fdf';
if(isset($_POST['b_fname'])){
$_POST['b_cphone']=$_POST['b_cphone'];
// get the FDF file contents
$fdf=createFDF($pdf_file,$_POST);
// Create a file for later use
if($fp=fopen($fdf_file,'w')){
fwrite($fp,$fdf,strlen($fdf));
$CREATED=TRUE;
}else{
echo 'Unable to create file: '.$fdf_file.'<br><br>';
$CREATED=FALSE;
}
fclose($fp);
}
?>