code works with IE but not FF ... sort of

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

code works with IE but not FF ... sort of

Post by inosent1 »

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:

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>
file 2 ... this is the file that creates the fdf file createFDF.php

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);
    }
?>


incubi
Forum Contributor
Posts: 119
Joined: Mon Dec 07, 2009 1:47 pm

Re: code works with IE but not FF ... sort of

Post by incubi »

Hi,

I looked at both your posts but I don't see where you tell us what you mean by "not working". Do you get an error or a blank page or do you get something this?

%FDF-1.2
%âãÏÓ
1 0 obj
<<
/FDF << /Fields [ <</T(__NAME__)/V(Test)>><</T(__TITLE__)/V(Test)>><</T(__EMAIL__)/V(Test)>><</T(__ADDRESS__)/V(Test)>><</T(__CITY__)/V(Test)>><</T(__STATE__)/V(Test)>><</T(__ZIP__)/V(Test)>><</T(__PHONE__)/V(Test)>><</T(__FAX__)/V(Test)>><</T(__CSZ__)/V(Test, Test Test)>>]
/F (http://koivi.com/fill-pdf-form-fields/test.pdf) /ID [ <09924debbdece10dab1fd52d63e9e988>
] >>
>>
endobj
trailer
<<
/Root 1 0 R

>>
%%EOF
Post Reply