Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/07/2011, 16:04
eriixt
 
Fecha de Ingreso: julio-2011
Ubicación: Argentina
Mensajes: 7
Antigüedad: 12 años, 10 meses
Puntos: 0
Pregunta [Problema] Solo Campos Rellenados PHP a PDF

Primero que nada buenas noches users de forosdelweb.com!, quisiera saber si me podrían ayudar con un problema que me esta matando! hace bastante que estoy con esto y no me sale!, les paso el detalle. Tengo un formulario en php con un modelo curriculum vitae, lo envió mediante _GET y lo muestra en pdf, hasta ahí voy bien, las variables del formulario me las toma y me las imprime correctamente, PERO el problema es que yo solo quiero mostrar solamente los campos que rellenaron.
Estoy haciendo la prueba con los campos de "ESTUDIOS REALIZADOS" y el "tipo 1 y estudio 1:" me lo muestra si lo relleno, si no no, perfecto, pero ahora cuando paso a hacer lo mismo con el Tipo2 y Estudio2 directamente no me muestra nada ni aunque este rellenado.

Necesitaría saber si me pueden decir donde esta el error para poder solucionar esto!.

Desde ya, muchas gracias. =).

Acá esta el link donde puse el formulario para que lo prueben.


[URL="http://testwebtest.hostzi.com/"]http://testwebtest.hostzi.com/
[/URL]

Uso la libreria TCPDF

cv.php

Código PHP:
<?php
// Rutas donde tendremos la libreria y el fichero de idiomas.
require_once('tcpdf/tcpdf.php');
 
// Crear el documento
$pdf = new TCPDF(PDF_PAGE_ORIENTATIONPDF_UNITPDF_PAGE_FORMATtrue'UTF-8'false);
 
// Información referente al PDF
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('CyberStation.Sol');
$pdf->SetTitle('Curriculum Vitae');
$pdf->SetSubject('Mi CV');
$pdf->SetKeywords('cv');
 
// Márgenes
$pdf->SetMargins(PDF_MARGIN_LEFTPDF_MARGIN_TOPPDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(false);
$pdf->SetFooterMargin(false);
 
// Saltos de página automáticos.
$pdf->SetAutoPageBreak(TRUEPDF_MARGIN_BOTTOM);
 
// Establecer el ratio para las imagenes que se puedan utilizar
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
 
// Establecer la fuente
$pdf->SetFont('helvetica''B'15);

// Eliminar lineas
$pdf->setPrintHeader(false); //no imprime la cabecera ni la linea 
$pdf->setPrintFooter(false); //no imprime el pie ni la linea 

// Añadir página
$pdf->AddPage();
$htmla '
<style>
    .subtitle2 {
    font-family: helvetica;
    font-size: 9;
    color: #000000;
    font-weight:normal;
    }
</style>

<table width="400" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="452" class="subtitle2"><b>'
.$_GET['direccion'].'</b></td>
    <td width="53" rowspan="5">&nbsp;</td>
    <td width="295" class="subtitle2"><b>Codigo Postal:</b> '
.$_GET['cp'].'</td>
  </tr>
  <tr>
    <td class="subtitle2"><b>'
.$_GET['ciudad'].'</b></td>
    <td class="subtitle2"><b>Celular:</b> '
.$_GET['celular'].'</td>
  </tr>
  <tr>
    <td class="subtitle2"><b>Partido de '
.$_GET['partido'].'</b></td>
    <td class="subtitle2"><b>Telefono:</b> '
.$_GET['telefono'].'</td>     
  </tr>
  <tr>
    <td class="subtitle2"></td>
    <td>&nbsp;</td>
  </tr>
</table>
'
;
// output the HTML content
$pdf->writeHTML($htmlatruefalsetruefalse'');
 
// Escribir una línea con el método CELL
//$pdf->Cell(0, 1, $_POST['nombre'], 0, 1, 'C');
$htmlb '
<style>
    .title {
    font-family: helvetica;
    font-size: 26;
    color: #000000;
    font-weight:normal;
    }
</style>

<table width="600" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" class="title">'
.$_GET['apellido'].' '.$_GET['nombre'].'</td>
  </tr>
</table>
'
;
// output the HTML content
$pdf->writeHTML($htmlbtruefalsetruefalse'');

$html '
<style>
    .title {
    font-family: helvetica;
    font-weight: bold;
    font-size: 14;
    color: #000000;
    }

    .subtitle {
    font-family: helvetica;
    font-size: 12;
    color: #000000;
    }
    
    .subtitle2 {
    font-family: helvetica;
    font-size: 10;
    color: #000000;
    font-weight:normal;
    }
    
    .celda {
    border-color:#747474;
    border-style:solid;
    border-width:thin;
    border-bottom-width:thin;
    border-top-width:thin;
    border-left-width:thin;
    border-right-width:thin;
    font-family: helvetica;
    font-size: 13;
    color: #000000;
    font-weight:normal;
    }
</style>

<br/>
<table width="800" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="162" bgcolor="#E5E5E5" class="subtitle">Datos Personales</td>
  </tr>
  
  <tr>
    <td rowspan="6">&nbsp;</td>
    <td class="subtitle2"> <b>• Fecha de Nacimiento:</b> '
.$_GET['fecha1'].' / '.$_GET['fecha2'].' / '.$_GET['fecha3'].'    </td>
  </tr>
     <tr>
    <td class="subtitle2"> <b>• Nacionalidad:</b> '
.$_GET['nacion'].'</td>
      </tr>
  <tr>
    <td class="subtitle2"> <b>• Edad:</b> '
.$_GET['edad'].' Años</td>
  </tr>
  <tr>
    <td class="subtitle2"> <b>• Estado Civil:</b> '
.$_GET['civil'].'</td>
  </tr>
  <tr>
    <td class="subtitle2"> <b>• D.N.I:</b> '
.$_GET['dni1'].'.'.$_GET['dni2'].'.'.$_GET['dni3'].'</td>
  </tr>
  <tr>
    <td class="subtitle2"> <b>• CUIL:</b> '
.$_GET['cuil1'].'-'.$_GET['cuil2'].'-'.$_GET['cuil3'].'</td>
  </tr>
</table>
<br>

<!--- EDUCACION --->

<table width="800" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="162" bgcolor="#E5E5E5" class="subtitle">Educación</td>
  </tr>
  
  <tr>
    <td rowspan="3">&nbsp;</td>
    <td class="subtitle2"> <b>• Primaria '
.$_GET['primaria'].':</b> '.$_GET['escuelaprimaria'].'    </td>
  </tr>
  <tr>
    <td class="subtitle2"> <b>• Secundaria '
.$_GET['secundaria'].':</b> '.$_GET['escuelasecundaria'].</td>
  </
tr>
</
table>
<
br>
ACA ESTAN LOS IF QUE HICE, EL PRIMERO ME SALE TODO PERFECTO, PERO EL SEGUNDO NO!

Código PHP:
<!--- ESTUDIOS REALIZADOS --->

<
table width="800" border="0" cellspacing="0" cellpadding="0">
  <
tr>
    <
td width="162" bgcolor="#E5E5E5" class="subtitle">Estudios Realizados</td>
  </
tr>
  
';
  if($_GET['
estudio1'] != "" )
          { 
            $html .= '
            
<tr>
                <
td rowspan="4">&nbsp;</td>
                   <
td class="subtitle2"> <b>• '.$_GET['estudio1'].' ('.$_GET['tipo1'].')</b></td>
             </
tr>';
        }
  if($_GET['
estudio2'] != "" ) <!--- EN ESTE IF SERIA EL PROBLEMA --->
          { 
            $html .= '
            
<tr>
                <
td rowspan="4">&nbsp;</td>
                   <
td class="subtitle2"> <b>• '.$_GET['estudio2'].' ('.$_GET['tipo2'].')</b></td>
             </
tr>';
        }
$html .='
 
</table>
<
br
Código PHP:
<!--- EXPERIENCIA LABORAL --->

<
table width="800" border="0" cellspacing="0" cellpadding="0">
  <
tr>
    <
td width="162" bgcolor="#E5E5E5" class="subtitle">Experiencia Laboral</td>
  </
tr>
  
  <
tr>
    <
td rowspan="7">&nbsp;</td>
    <
td class="subtitle2"> <b>• '.$_GET['empresa1'].'</b><br>
    <
b>Tarea Desempeñada:</b'.$_GET['tarea1'].'<br>
    <
b>Tiempo:</b'.$_GET['tiempo1'].'<br>
    <
b>Ubicación:</b'.$_GET['ubicacion1'].'</td>
  </
tr>
  <
tr>
    <
td></td>
  </
tr>
  <
tr>
    <
td class="subtitle2"> <b>• '.$_GET['empresa2'].'</b><br>
    <
b>Tarea Desempeñada:</b'.$_GET['tarea2'].'<br>
    <
b>Tiempo:</b'.$_GET['tiempo2'].'<br>
    <
b>Ubicación:</b'.$_GET['ubicacion2'].'</td>
  </
tr>
  <
tr>
    <
td></td>
  </
tr>
  <
tr>
    <
td class="subtitle2"> <b>• '.$_GET['empresa3'].'</b><br>
    <
b>Tarea Desempeñada:</b'.$_GET['tarea3'].'<br>
    <
b>Tiempo:</b'.$_GET['tiempo3'].'<br>
    <
b>Ubicación:</b'.$_GET['ubicacion3'].'</td>
  </
tr>
</
table>

<!--- 
OTROS --->
<
p>
<
table width="640" border="0" cellspacing="0" cellpadding="0">
  <
tr>
    <
td align="center" class="subtitle2"><b>Disponibilidad:</b'.$_GET['disponibilidad'].'</td>
  </
tr>
  <
tr>
    <
td>&nbsp;</td>
  </
tr>
  <
tr>
    <
td align="center" class="celda">Objetivo'.$_GET['objetivo'].'</td>
  </
tr>
</
table>
';
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
 
// ---------------------------------------------------------
 
//Cerramos y damos salida al fichero PDF
$pdf->Output('
CV.pdf', 'I);
?> 

Última edición por eriixt; 05/07/2011 a las 16:12