Re-Bonjour, maintenant il me reste à réussir l'insertion du QR Code ...
Voici le code de mon fichier reservation_web.php qui affiche un tableau de données de la table RESERVATION de ma Base De Données ...
<div class="panel3-reservation-web">
<table style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; font-weight:bold;">
<tr style="background-color: orange; height:20px;">
<td style="width:84px; text-align:center; color:#FFFFFF;">Nom</td>
<td style="width:84px; text-align:center; color:#FFFFFF;">Prénom</td>
<td style="width:41px; text-align:center; color:#FFFFFF;">Sexe</td>
<td style="width:84px; text-align:center; color:#FFFFFF;">Ville</td>
<td style="width:84px; text-align:center; color:#FFFFFF;">Pays</td>
<td style="width:101px; text-align:center; color:#FFFFFF;">Tél.</td>
<td style="width:161px; text-align:center; color:#FFFFFF;">E-mail</td>
<td style="width:31px; text-align:center; color:#FFFFFF;">Ch</td>
<td style="width:71px; text-align:center; color:#FFFFFF;">Arrivée</td>
<td style="width:71px; text-align:center; color:#FFFFFF;">Départ</td>
<td style="width:33px; text-align:center; color:#FFFFFF;">Adt</td>
<td style="width:33px; text-align:center; color:#FFFFFF;">Enf</td>
<td style="width:82px; text-align:center; color:#FFFFFF;">Action</td>
</tr>
</table>
</div>
<div class="panel4-reservation-web">
<?php
$sql = $bdd->prepare('SELECT * FROM reservation ORDER BY id ASC');
$sql->execute();
while($reservation = $sql->fetch())
{
?>
<table align="left" style="font-family:Verdana; font-size:9px; color:#000000;">
<tr style="background-color: white; height:15px; ">
<td style="width:83px; text-align:center; border-bottom:1px solid #666666; border-left:1px solid #666666;"><?php echo html_entity_decode($reservation['nom']); ?></td>
<td style="width:83px; text-align:center; border-bottom:1px solid #666666; border-left:1px solid #666666;"><?php echo html_entity_decode($reservation['prenom']); ?></td>
<td style="width:40px; text-align:center; border-bottom:1px solid #666666; border-left:1px solid #666666;"><?php echo html_entity_decode($reservation['sexe']); ?></td>
<td style="width:83px; text-align:center; border-bottom:1px solid #666666; border-left:1px solid #666666;"><?php echo html_entity_decode($reservation['ville']); ?></td>
<td style="width:83px; text-align:center; border-bottom:1px solid #666666; border-left:1px solid #666666;"><?php echo html_entity_decode($reservation['pays']); ?></td>
<td style="width:100px; text-align:center; border-bottom:1px solid #666666; border-left:1px solid #666666;"><?php echo html_entity_decode($reservation['tel']); ?></td>
<td style="width:160px; text-align:center; border-bottom:1px solid #666666; border-left:1px solid #666666;"><?php echo html_entity_decode($reservation['email']); ?></td>
<td style="width:30px; text-align:center; border-bottom:1px solid #666666; border-left:1px solid #666666;"><?php echo html_entity_decode($reservation['chambre']); ?></td>
<td style="width:70px; text-align:center; border-bottom:1px solid #666666; border-left:1px solid #666666;"><?php echo html_entity_decode($reservation['arrivee']); ?></td>
<td style="width:70px; text-align:center; border-bottom:1px solid #666666; border-left:1px solid #666666;"><?php echo html_entity_decode($reservation['depart']); ?></td>
<td style="width:32px; text-align:center; border-bottom:1px solid #666666; border-left:1px solid #666666;"><?php echo html_entity_decode($reservation['adulte']); ?></td>
<td style="width:32px; text-align:center; border-bottom:1px solid #666666; border-left:1px solid #666666;"><?php echo html_entity_decode($reservation['enfant']); ?></td>
<td style="width:60px; font-size:9px; text-align:center; border-bottom:1px solid #666666; border-left:1px solid #666666;">
<table>
<tr>
<td><a href="delete_reservation_web.php?supprimer=<?php echo $reservation['id']; ?>" onclick="if (!confirm('Voulez-vous supprimer cette réservation Web ?'))
return false;">Sup</a> | <a href="load_reservation.php?id=<?php echo $reservation['id']; ?>">Imp</a></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
}
?>
</div>
Ensuite le Code du fichier "load_reservation.php" qui reçoit l'ID ...
<?php
/**
- HTML2PDF Librairy - example
*
- HTML => PDF convertor
- distributed under the LGPL License
*
- @author Laurent MINGUET <webmaster@html2pdf.fr>
*
- isset($_GET['vuehtml']) is not mandatory
- it allow to display the result in the HTML format
- /
// get the HTML
//insertion de la requete SQL pour recuperer les infos de la reservation
include('connexion.php');
$sql = $bdd->prepare('SELECT * FROM reservation WHERE id = "'.$_GET['id'].'"');
$sql->execute();
$reservation = $sql->fetch();
ob_start();
include('./print_reservation.php');
$content = ob_get_clean();
// convert in PDF
require_once('./html2pdf_v4.03/html2pdf.class.php');
try
{
$html2pdf = new HTML2PDF('P', 'A4', 'fr');
// $html2pdf->setModeDebug();
$html2pdf->setDefaultFont('Arial');
$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
$html2pdf->Output('reservation.pdf');
}
catch(HTML2PDF_exception $e) {
echo $e;
exit;
}
?>
Et enfin, le fichier qui permet de faire la mise en forme pour imprimer en PDF ...
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Content-Type" content="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7;">
<!-- Page d'accueil du site -->
<link rel="start" title="Hotel Radisson" href="../../index.php" />
<!-- Icône du site (favicon) -->
<link rel="shortcut icon" type="image/x-icon" href="../pictures/radisson1_logo_favicon.png" />
<!-- Feuilles de style -->
<link rel="stylesheet" type="text/css" href="../include/style-hlj.css" />
<title>Etat des Réservations en ligne</title>
<script language="JavaScript"><!--
var dom;
dom = document.getElementById;//browser
//déclaration variables
var timer;
var temps=new Date;
var val_heure;
function init() {
if (dom) sknheure = document.getElementById("heu");
}//end of init
function heure() {
temps= new Date;
h=temps.getHours();
m=temps.getMinutes();
s=temps.getSeconds();
val_heure=h+'h '+m+'m '+s+'s';
if (dom) sknheure.innerHTML = '<span><font color="white" face="verdana" size=-2><b>'+ val_heure +'</B></font></span>';
timer = window.setTimeout('heure()',1000); //affichage des secondes dans 1 seconde
}//end of heure
//-->
</script>
<style type="text/css">
.centre {
text-align: center;
}
.left {
text-align: right;
}
</style>
</head>
<body style="margin:auto;" onLoad="init(); heure();" onunload="clearTimeout(timer);">
<table width="890" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150"><img src="../pictures/radisson1_logo_small.png" class="frame" /></td>
<td width="150" align="center" valign="middle"></td>
<td width="50">ID <?php print_r($_GET['id']); ?></td>
<td width="150" align="center" valign="middle"></td>
<td width="490">Brazzaville, le <?php require("date_heure_fr.php");?><span id="heu"></span></td>
</tr>
</table>
<h4 class="centre">RÉSERVATION DE CHAMBRE EN LIGNE</h4>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center" valign="middle"><h4>Nom</h4></td>
<td width="300" align="center" valign="middle"><h4><?php echo html_entity_decode($reservation['nom']); ?></h4></td>
</tr>
</table>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center" valign="middle"><h4>Prénom</h4></td>
<td width="300" align="center" valign="middle"><h4><?php echo html_entity_decode($reservation['prenom']); ?></h4></td>
</tr>
</table>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center" valign="middle"><h4>Sexe</h4></td>
<td width="300" align="center" valign="middle"><h4><?php echo html_entity_decode($reservation['sexe']); ?></h4></td>
</tr>
</table>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center" valign="middle"><h4>Ville</h4></td>
<td width="300" align="center" valign="middle"><h4><?php echo html_entity_decode($reservation['ville']); ?></h4></td>
</tr>
</table>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center" valign="middle"><h4>Pays</h4></td>
<td width="300" align="center" valign="middle"><h4><?php echo html_entity_decode($reservation['pays']); ?></h4></td>
</tr>
</table>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center" valign="middle"><h4>Téléphone</h4></td>
<td width="300" align="center" valign="middle"><h4><?php echo html_entity_decode($reservation['tel']); ?></h4></td>
</tr>
</table>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center" valign="middle"><h4>E-mail</h4></td>
<td width="300" align="center" valign="middle"><h4><?php echo html_entity_decode($reservation['email']); ?></h4></td>
</tr>
</table>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center" valign="middle"><h4>Chambre</h4></td>
<td width="300" align="center" valign="middle"><h4><?php echo html_entity_decode($reservation['chambre']); ?></h4></td>
</tr>
</table>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center" valign="middle"><h4>Arrivée</h4></td>
<td width="300" align="center" valign="middle"><h4><?php echo html_entity_decode($reservation['arrivee']); ?></h4></td>
</tr>
</table>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center" valign="middle"><h4>Départ</h4></td>
<td width="300" align="center" valign="middle"><h4><?php echo html_entity_decode($reservation['depart']); ?></h4></td>
</tr>
</table>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center" valign="middle"><h4>Nb Adulte</h4></td>
<td width="300" align="center" valign="middle"><h4><?php echo html_entity_decode($reservation['adulte']); ?></h4></td>
</tr>
</table>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center" valign="middle"><h4>Nb Enfant</h4></td>
<td width="300" align="center" valign="middle"><h4><?php echo html_entity_decode($reservation['enfant']); ?></h4></td>
</tr>
</table>
<p class="left">Fait à Brazzaville, le <?php require("date_heure_fr.php");?></p>
</body>
</html>