I have a code that should show me certain data according to the date that the user sends by form, that is, I need to be shown a certain number of orders in a certain range of dates but it turns out that the table that I am shown this empty, attached form code and who performs the action:
<html>
<body style="background-color:#47D4A2;">
<h1 align=center> Tomy Resfrescos S.A</h1>
<h2> Listados de pedidos </h2>
<h4> Ingrese rango de fechas: </h4>
<form action="http://localhost/prueba/ResultadoDePedidos.php" method="GET"id="formulario">
Fecha inicial:<input name="fecha1" type="date">
<br>
Fecha final:<input name="fecha2" type="date">
<br>
<input type="submit" value="continuar"/>
</form>
</body>
</html>
and this is the other:
<?php
include("conexion.php");
$fecha1=$_GET['fecha1'];
$fecha2=$_GET['fecha2'];
$link=Conectarse();
$result=mysql_query("SELECT num_ped,fec_rep FROM pedidos WHERE fec_rep>=
$fecha1 AND fec_rep<= $fecha2",$link);
?>
<TABLE BORDER=1 CELLSPACING=1
CELLPADDING=1>
<TR><TD> Numero de Pedido</TD><TD> Fecha de Entrega </TD> </TR>
<?php
while($row= mysql_fetch_array($result)) {
printf("<tr>
<td> %s</td>
<td> %s </td>
</tr>",
$row["0"],$row["1"]);
}
mysql_free_result($result);
mysql_close($link);
?>
</table>
</body>
</html>
The problem is that the table with the names of the columns is shown, the connection is successful but the table is empty and I do not understand why.