Código PHP:
<html>
<head>
<title>Problema</title>
</head>
<body>
<?php
$v1 = $_POST['Pre'];
echo $v1;
$hoy = date("j, n, Y");
//echo $hoy;
$conexion=mysqli_connect("localhost","root","","htl") or
die("Problemas con la conexión");
mysqli_query($conexion, "INSERT into tarifas
(nr,
single,
iva,
doble,
triple,
cuadr,
dpto2p,
dpto3p,
dpto4p,
dpto5p,
dpto6p,
dpto7p,
dpto8p,
suite,
pecomp,
mediap,
desayuno,
almcena,
bcomun1,
bcomun2,
bcomun3,
bcomun4,
fecha)
VALUES
('$_POST[Pre]',
'$_REQUEST[valsing]',
'$_REQUEST[iva]',
'$_REQUEST[valdob]',
'$_REQUEST[valtrip]',
'$_REQUEST[valcuad]',
'$_REQUEST[valdep2]',
'$_REQUEST[valdep3]',
'$_REQUEST[valdep4]',
'$_REQUEST[valdep5]',
'$_REQUEST[valdep6]',
'$_REQUEST[valdep7]',
'$_REQUEST[valdep8]',
'$_REQUEST[valsuit]',
'$_REQUEST[pcomp]',
'$_REQUEST[valmp]',
'$_REQUEST[valdesa]',
'$_REQUEST[alcen]',
'$_REQUEST[baco1]',
'$_REQUEST[baco2]',
'$_REQUEST[baco3]',
'$_REQUEST[baco4]',
now())")
or
die("Problemas en el select:".mysqli_error($conexion));
echo "El establecimiento fue modificado con exito";
echo $v1;
echo $hoy ;
?>
<HTML>
<form action="http://localhost/pdf/reporte.php" method="post">
<input type="hidden" name="fecha" value=<?php echo $hoy;?> />
<input type="hidden" name="regis" value=<?php $v1;?> />
<input type="submit" value="Imprimir Tarifas" />
</form>
</HTML>
</body>
</html>
Código PHP:
<?php
echo $v1;
$hoy = date("j, n, Y");
echo $hoy;
include 'plantilla.php';
require 'conexion.php';
$query = "SELECT * FROM tarifas where nr = $v1 and fecha=$hoy";
$resultado = $mysqli->query($query);
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFillColor(232,232,232);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(30,6,'Servicio Unidad',1,0,'',1);
$pdf->Cell(30,6,'Baño Privado',1,0,'',1);
$pdf->Cell(30,6,'Baño Comun',1,0,'',1);
$pdf->Cell(30,6,'Des. Incluido',1,0,'',1);
$pdf->Cell(30,6,'IVA incluido',1,1,'',1);
$pdf->SetFont('Arial','',10);
while($row = $resultado->fetch_assoc())
{
$pdf->Cell(30,6,'fecha',1,0,'',1);
$pdf->Cell(30,6,'Single',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['single']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun1']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Doble',1,0,'',1);
$pdf->Cell(30,6,$row['doble'],1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun2']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Triple',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['triple']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun3']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Cuadruple',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['cuadr']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun4']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Dpto 2 p.',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['dpto2p']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun4']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Dpto 3 p.',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['dpto3p']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun4']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Dpto 4 p.',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['dpto4p']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun4']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Dpto 5 p.',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['dpto5p']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun4']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Dpto 6 p.',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['dpto6p']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun4']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Dpto 7 p.',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['dpto7p']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun4']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Dpto 8 p.',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['dpto8p']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun4']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Suite',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['suite']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun4']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Pens. Compl',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['pecomp']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun4']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Media Pens.',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['mediap']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun4']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Desayuno',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun4']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
$pdf->Cell(30,6,'Alm/Cena',1,0,'',1);
$pdf->Cell(30,6,utf8_decode($row['almcena']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['bcomun4']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['desayuno']),1,0,'C');
$pdf->Cell(30,6,utf8_decode($row['iva']),1,1,'C');
}
$pdf->Output();
?>