Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/03/2012, 17:20
dasapa
 
Fecha de Ingreso: octubre-2011
Mensajes: 206
Antigüedad: 12 años, 6 meses
Puntos: 1
Pasar variables a fpdf

tengo el siguiente formulario con tres campos, se hace la multiplicacion entre dos de ellos y se muestra el resultado. Luego quiero sacarlo en pdf.

Código PHP:
<!DOCTYPE html>
<
html>
    <
head>
     <
script type="text/javascript">
       function 
Calcular(){
        var 
b1=document.getElementById("textfield42").value;
        var 
b2 document.getElementById("textfield43").value;
        var 
b3=b1*b2;
        
document.getElementById("textfield44").value b3
       }
   
</script>
    </head> 
        <body>    
        <!--Formulario tarifa-->
       <div id="frmTarifa" style="position:relative;top:225px;background-color:#4FA700">
        <form action="pdf.php" name="frmTarifa" id="frmTarifa"style="background-color:#4FA700" method="Post" > 
                  <table name="frmTarifa" style="width:330px;height:auto;background-color:#B8DC99">   
                      <tr>
                          <td>                             
        <div><span>Operando 1: </span>
        <input type="Text"  id="textfield42" name=textfield42 /> 
        <br>
        <div><span>Operando 2: </span>
        <input type="Text"  id="textfield43" name="textfield43" /> </div>
      <br>
        <div><span>Resultado: </span>
        <input type="Text"  id="textfield44" name="textfield44" />
        <input type="button"  name="btnCalcular" onclick="Calcular()" value="Calcular"/>
        <input type="submit" id="btnCrearOferta" value="Crear Oferta"/></div> 
        <br>
                         </td>
                      </tr>
                  </table>     
            </form>
        </div>               
    </body>
</html> 
y este sería el codigo que me genera el pdf (pdf.php)

Código PHP:
$pdf = new PDF('L','mm','A4');
$pdf->AddPage();
$pdf->SetFont('Helvetica','B',12);
$pdf->Text(93,26,utf8_decode('CÓDIGO DE LA OFERTA:'));
$pdf->Text(193,26,utf8_decode('FECHA:'));
$pdf->SetFont('Helvetica','',12);
$pdf->SetXY(14521);
$pdf->Cell(45,8,iconv('UTF-8''windows-1252',$_POST['textfield42']),0,1,'L');
$pdf->Cell(65,8,iconv('UTF-8''windows-1252',$_POST['textfield43']),0,1,'L');
$pdf->Cell(85,8,iconv('UTF-8''windows-1252',$_POST['textfield44']),0,1,'L');
$pdf->Output(); 
El problema es con el textfield44, el valor del resultado en el formulario me da error al generar el pdf

"FPDF error: Some data has already been output, can't send PDF file"

Alguna ayuda por favor...