Hello, I need to put several filters on a page as a search of several fields I have a table where it gives all the information and my filters are start date, end date and department this is my code, but my query to perform the search of the dates and the department do not know how to perform them
<center><h1>Solicitud Pendiente</h1><br></center>
<form method="post" id="fomr1">
<center>
<td><font color="#000">Fecha Inicial:</font><input type="date" name="fechaini" id="fechafin"></td>
<td><font color="#000">Fecha Final:</font><input type="date" name="fechafin" id="fechafin" ></td>
<label for="select">Departamento:</label><select name="id_departamento" id="select" required placeholder="" style="width:330px; height: 25px">
<option value="">Seleccionar..</option>
<?php
$departamento = "select id_departamento, nombre ,id_gerencia from departamento where status=1";
$mostrardepartamento=mysql_query($departamento);
while($i=mysql_fetch_array($mostrardepartamento)){
?>
<option value="<?php echo $i["id_departamento"];?>"><?php
$i["id_gerencia"];?><?php
echo $i["nombre"];?></option>
<?php
}
?>
<?php
$empleadou = mysql_query("SELECT * FROM usuarios WHERE correo = '$username' ");
$nosepon= mysql_fetch_array($empleadou);
?>
</select>
<td><input type="submit" value="Mostrar" name="mostrar" id="mostrar" ></td>
</center>
</form>
<br>
<div class="tbl-header">
<center> <table class="bordered" cellpadding="0" cellspacing="0" border="0" class="tab">
<thead>
<tr>
<th scope="col">ID folio</th>
<th scope="col" style="width:30px;">Fecha</th>
<th scope="col">Departamento</th>
<th scope="col">Descripción del trabajo</th>
<th scope="col">Nombre servicio</th>
<th scope="col">Costo</th>
<th scope="col">Autorización Solicitante</th>
<th scope="col">Autorización Dirección</th>
<th scope="col">Autorización Gerencia</th>
<th scope="col">Revisa trabajo</th>
<th scope="col">Recibe trabajo Terminado</th>
<th scope="col">Nombre empleado</th>
<th scope="col">Tipo de solicitud</th>
</tr>
<?php
$empleadou = mysql_query("SELECT * FROM usuarios WHERE correo = '$usernamee' ");
$nosepon= mysql_fetch_array($empleadou);
if(($_POST['fechaini']=="") && ($_POST['fechafin']==""))
{
$consulta="";
}else
{
$consulta="AND s.fecha BETWEEN '".$_POST['fechaini']."' AND '".$_POST['fechafin']."' ";
}
if ($_POST["id_departamento"]=="")
{
$consulta="";
}else
{
$consulta="AND s.id_departamento BETWEEN '".$_POST['id_departamento']."";
}
$so = "SELECT s.Id_folio, s.fecha,s.descripcion_trabajo, s.Id_servicio,s.tipo_solicitud, s.costo, s.id_vehiculo,s.id_departamento, d.id_departamento,d.nombre,u.Empleado_Nombre, u.Empleado_id, t.Id_servicio, t.Nombre_servicio,s.Autoriza_Soli,s.Autoriza_Ger,s.Autoriza_GerIs ,s.Autoriza_trab,s.Autoriza_termi FROM solicitud as s, departamento as d, usuarios as u, tipo_servicio as t WHERE s.Empleado_id =u.Empleado_id and s.id_departamento=d.id_departamento and s.Id_servicio =t.Id_servicio and Autoriza_termi=0 and Autoriza_trab=0 AND horaAutorizaG IS NULL AND estatus = '1' ".$consulta."";
$mostrarso=mysql_query($so);
while($i=mysql_fetch_array($mostrarso)){
?>
<tr>
<td><a href=<?php echo "Sform2.php?Id_folio=".$i['Id_folio']." "?>><?php echo $i["Id_folio"];?></td>
<td><?php echo $i["fecha"];?></td>
<td ><?php echo $i["nombre"];?></td>
<td><textarea name="" cols="10" rows="2" autofocus class="form-textarea" id="input_7" title="" data-component="textarea" textarea readonly="readonly"><?php echo $i["descripcion_trabajo"];?></textarea></td>
<td ><?php echo $i["Nombre_servicio"];?></td>
<td><?php echo $i["costo"];?></td>
<?php if($i[13]==1){$marcar="checked";}else{$marcar="";}?>
<td ><input type="checkbox" disabled <?php echo $marcar;?>></td>
<?php if($i[15]==3){$marcar1="checked";}else{$marcar1="";}?>
<td><input type="checkbox" disabled <?php echo $marcar1;?>></td>
<?php if($i[14]==2){$marcar2="checked";}else{$marcar2="";}?>
<td><input type="checkbox" disabled <?php echo $marcar2;?>></td>
<?php if($i[16]==4){$marcar3="checked";}else{$marcar3="";}?>
<td><input type="checkbox" disabled <?php echo $marcar3;?>></td>
<?php if($i[17]==5){$marcar4="checked";}else{$marcar4="";}?>
<td><input type="checkbox" disabled <?php echo $marcar4;?>></td>
<td><?php echo $i["Empleado_Nombre"];?></td>
<td><?php echo $i["tipo_solicitud"];?></td>
</tr>
<?php
}
echo"<a hre>"
?>
</thead>
</table></center>
</div>