0
I have the following code that when selecting a month, it puts in the variable $mes, the selected value:
if (isset($_POST['mes']))
{
$mes = $_POST['mes'];
echo "$mes";
}
(isset($_POST["mes"])) ? $mes1 = $_POST["mes"] : $mes1=3;
echo '
<form method="post" action="" name="form">
<select name="mes" id="mes">
<option value="1">Janeiro</option>
<option value="2">Fevereiro</option>
<option value="3">Março</option>
<option value="4">Abril</option>
<option value="5">Maio</option>
<option value="6">Junho</option>
<option value="7">Julho</option>
<option value="8">Agosto</option>
<option value="9">Setembro</option>
<option value="10">Outubro</option>
<option value="11">Novembro</option>
<option value="12">Dezembro</option>
</select>
<input name="submit" type="submit">
</form>
';
But after selecting and functioning, the select field goes back to the first value, in the case January.
How do I, after selecting and giving ok, select the field to be selected the value $mes?
worked perfect! Thank you!!!
– Leandro Teraoka
Taking advantage (forgot to put) in case of input how would be? I have an input field that is the year <input type="number" id="year" name="year" value="2017" style="width:100px;"></input>
– Leandro Teraoka