1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
<?php
require('html2pdf.php');
if(isset($_POST['pdf'])){
$pdf=new PDF_HTML();
$pdf->SetFont('Arial','',12);
$pdf->AddPage();
$text=file_get_contents('http://testPDF.php');
if(ini_get('magic_quotes_gpc')=='1')
$text=stripslashes($text);
$pdf->WriteHTML($text);
$pdf->Output();
exit;
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" name="testPDF" method="POST">
<input type="submit" value="Générer un PDF" name="pdf" />
<table border="1" align="center">
<thead>
<tr>
<th>Nom Stagiaire</th>
<th>Nom Encadrant</th>
</tr>
</thead>
<tbody>
<?php
require 'connexion.php';
$reqSelection = "select stagiare.IDENCADRANT, stagiare.NOMSTAGIARE,
stagiare.PRENOMSTAGIAIRE, encadrant.IDENCADRANT, encadrant.NOMENCADRANT,
encadrant.PRENOMENCADRANT from encadrant, stagiare where encadrant.IDENCADRANT = stagiare.IDENCADRANT";
$resultatReqSelection = mysql_query($reqSelection) or die("Impossible d'executer cette Requête ". mysql_error());
while($ligne = mysql_fetch_assoc($resultatReqSelection)){
echo '<tr>';
echo '<td>'.$ligne['NOMSTAGIARE'].' '.$ligne['PRENOMSTAGIAIRE'].'</td>';
echo '<td>'.$ligne['NOMENCADRANT'].' '.$ligne['PRENOMSTAGIAIRE'].'</td>';
echo '</tr>';
}
?>
</tbody>
</table>
</form> |
Partager