I need to make the SELECT field that looks like this today (code below) only displayed the previous, current, and next months. For example: As we are in the month of MAY, then it will display in this select (html) only the months of APRIL MAY and JUNE and as the months go by it will show MAY, JUNE and JULY ....
I'm getting system ready to modify here at the stage what I currently have code for is this:
<select class="form-control" style="width: 200px;" name="Mes" id="Mes" onblur="verificaDataBaixaBoleto();">
<?php
$y = date('n'); // Mês 1 a 12
if($this->mes){
$mesatual = $this->mes;
}
for($x=1;$x<=12;$x++){
$mes = $x;
echo "<option";
if($x == $mesatual){
echo " selected='selected'";
}
echo " value='";
echo $mes;
echo "'>";
if($x == 1){
echo "Janeiro";
}
if($x == 2){
echo "Fevereiro";
}
if($x == 3){
echo "Março";
}
if($x == 4){
echo "Abril";
}
if($x == 5){
echo "Maio";
}
if($x == 6){
echo "Junho";
}
if($x == 7){
echo "Julho";
}
if($x == 8){
echo "Agosto";
}
if($x == 9){
echo "Setembro";
}
if($x == 10){
echo "Outubro";
}
if($x == 11){
echo "Novembro";
}
if($x == 12){
echo "Dezembro";
}
echo "</option>";
}
?>
</select>
I was trying to make some comparison so that it could be displayed, but I think I got lost in logic.