Hi, I have this detail of doing a filter with only one month I have a date field (Ymd) and another field month from which I take the date field dividing the date into parts to only print the month which I printed the month with number after Now I want to filter by month but I do not know how to do the query? here is my input that is the filter of the month
<td>Mes:<input value="Mes"type="month" name="mes" id="mes"></td>
<td><input type="submit" value="Mostrar" name="mostrar" id="mostrar" >
later this is my division of my date
$mostrarso=mysql_query($so);
while($i=mysql_fetch_array($mostrarso)){
date_default_timezone_set('Europe/Madrid');
setlocale(LC_TIME, 'es_ES.UTF-8');
setlocale(LC_TIME, 'spanish');
$nombremes=strftime("%B", strtotime($fecha_mes=$i[1]));
$fecha_mes=$i[1];
$partes = explode('-', $fecha_mes);
$_fecha = "{$partes[2]}-{$partes[1]}-{$partes[0]}"
I have tried to ask my question but it is not
if(($_POST['mes']=="") && ($_POST[$nombremes]==""))
{
$consulta="";
}else
{
$consulta="AND date_format(s.fecha,'%m') BETWEEN '".$_POST['mes']."' AND '".$_POST["s.fecha"]."'";
}