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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
<form method="post" action ="result_bdd.php">
<?php
require_once(dirname(__FILE__).'/html2pdf/html2pdf.class.php');
$html2pdf = new HTML2PDF('P','A4','fr');
ob_start();
$bdd = new PDO('mysql:host=localhost;dbname=application_v2', 'root', '');
$requete="SELECT * FROM ofs";
$resultats=$bdd->query($requete);
$resultats->setFetchMode(PDO::FETCH_OBJ);
// construction du tableau HTML
print '<table border=1>
<!-- impression des titres de colonnes -->
<TR>
<TD>Choix</TD><TD>id ofs </TD><TD>PHASE</TD><TD>Date Envoi</TD><TD>receptionniste</TD><TD>chauffeur</TD><TD>commentaire </TD><TD>AOG </TD><TD>Rouge</TD>
</TR>';
while( $resultat = $resultats->fetch() )
{
print'<TR>';
$of_result =$resultat->id_ofs;
$phase_result =$resultat->phase;
$date_envoi_result =$resultat->date_envoi;
$receptionniste_result = $resultat->receptionniste;
$chauffeur_result = $resultat->commentaire;
$commentaire_result = $resultat->aog;
$aog_result = $resultat->aog;
$rouge_result = $resultat->rouge;
//var_dump($resultat);
echo "<td><input type='checkbox' name='choix[]' value='$of_result.-.$phase_result.-.$date_envoi_result.-.$receptionniste_result.-.$chauffeur_result.-.$commentaire_result.-.$aog_result.-.$rouge_result'>
</td>";
echo '<td>'.$resultat->id_ofs.'</td>';
echo '<td>'.$resultat->phase.'</td>';
echo '<td>'.$resultat->date_envoi.'</td>';
echo '<td>'.$resultat->receptionniste.'</td>';
echo '<td>'.$resultat->chauffeur.'</td>';
echo '<td>'.$resultat->commentaire.'</td>';
echo '<td>'.$resultat->aog.'</td>';
echo '<td>'.$resultat->rouge.'</td>';
echo'</TR>';
}
print '</TABLE>'; ?>
//*********jusqu'ici tou va bien**********
<?php
if(!empty($_POST))
{
echo '<b>Vous avez Sélectionné</b> :<br> ';
$value_choix=null;
// la variable $content tout le code affiché tel quel dans le pdf généré
$content='
<table><?php
for ($i=0; $i<sizeof($_POST[\"choix\"]); $i++)
{
?>
<tr>
<?
$value_choix = explode(\".-.\",$_POST[\"choix\"][$i]);
for($j=0;$j<sizeof($value_choix);$j++)
{
echo $value_choix[$j].<br>;
$of_select=$value_choix[0];
$phase_select = $value_choix[1];
$date_envoi_select = $value_choix[2];
$receptionniste_select = $value_choix[3];
$chauffeur_select = $value_choix[4];
$commentaire_select = $value_choix[5];
$aog_select = $value_choix[6];
$rouge_select = $value_choix[7];
echo "<td>OF :".$of_select "</td>";
echo "<td>phase_select :".$phase_select "</td>";
<?php
}
?>
</tr>
<?php
}?>
</table>';
$html2pdf->WriteHTML($content);
//clean output
ob_clean();
$html2pdf->Output('impression.pdf');
}
?>
<input type="submit" value="VALIDER" /> |
Partager