I have the following code PHP
and HTML
I want to filter by dates first and then send data by means of a drop-down list. but when I run it, it shows me the following error:
syntax error, unexpected '==' (T_IS_EQUAL) in C: \ AppServ \ www \ central \ index.php on line 21 line 21 is this:
if(isset($desde))==false)
{$desde == $hasta;}
Some solution or improvement will appreciate comments.
<html>
<section
<table border="3" align="center">
<tr>
<td><input type="date" id="bd-desde"/></td>
<td>Hasta </td>
<td><input type="date" id="bd-hasta"/></td>
</tr>
</table>
</section>
<?php
$desde = $_POST['desde'];
$hasta = $_POST['hasta'];
if(isset($desde))==false){$desde = $hasta;}
if(isset($hasta)==false){
$hasta = $desde;
if(isset($_POST['filtro'],$_POST['desde'],$_POST['hasta'])){
switch($_POST['filtro']){
case "Nimajuyu":
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms) in(19) AND central in (02)
order by central,correlativo_dcms, archivo_dcms;";
break;
case "El Carmen 2":
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms) in(19) AND central in (04)
order by central,correlativo_dcms, archivo_dcms;";
break;
case "Monte Verde 5":
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms) in(19) AND central in (05)
order by central,correlativo_dcms, archivo_dcms;";
break;
case "Lourdes EIN":
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms) in(19) AND central in (08)
order by central,correlativo_dcms, archivo_dcms;";
break;
case "Guarda Transito":
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms) in(19) AND central in (11)
order by central,correlativo_dcms, archivo_dcms;";
break;
case "Guarda Viejo 5":
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms) in(19) AND central in (12)
order by central,correlativo_dcms, archivo_dcms;";
break;
case "Centro Transito EIN":
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms) in(19) AND central in (15)
order by central,correlativo_dcms, archivo_dcms;";
break;
case "Tivoli":
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms) in(19) AND central in (205)
order by central,correlativo_dcms, archivo_dcms;";
break;
case "Villa de Guadalupe 3":
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms) in(19) AND central in (207)
order by archivo_dcms asc;";
break;
case "Aristos":
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms) in(19) AND central in (208)
order by central,correlativo_dcms, archivo_dcms;";
break;
case "Chimaltenango":
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms) in(19) AND central in (302)
order by central,correlativo_dcms, archivo_dcms;";
break;
case "Retalhuleu":
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms) in(19) AND central in (304)
order by central,correlativo_dcms, archivo_dcms;";
break;
case "Zacapa":
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms) in(19) AND central in (307)
order by central,correlativo_dcms, archivo_dcms;";
break;
}
}else{
$sql = "select * from tarificado.rep_con where extract(week from fecha_dcms)";
}
?>