0
I need help with the following:
Method to get the date
function pegar_ano(){
$year = date('Y');
$ano = date('Y');
//echo $year;
$ano_anterior = $_POST['ano_anterior'];
$ano_atual= $_POST['ano_atual'];
$ano_posterior= $_POST['ano_posterior'];
if($ano_anterior != " "){
$year = $ano_anterior;
}
if($ano_posterior != " "){
$year = $ano_posterior;
}
if($ano_atual != " "){
$year = $ano_atual;
}
return $year;
}
Form in html
<form method="post" action="">
<br><br>
<button type="submit" class="button1" name="ano_anterior" value="<?php echo $year - 1; ?>" style="padding: 5px 20px;"> Ano Anterior </button>
<button type="submit" class="button1" name="ano_atual" value="<?php echo date("Y") ; ?>" style="padding: 5px 20px;"> Ano Atual </button>
<button type="submit" class="button1" name="ano_posterior" value="<?php echo $year + 1; ?>" style="padding: 5px 20px;"> Ano Posterior </button>
</form>
Inside of another Function
It would put the peg_year inside another Function to build the date, then make the query in sql
$data = pegar_ano().'-'.$mes.'-'.$a.$diacorrente;
But I don’t understand, what is the doubt?
– MikeDoouglas
The function is not picking up the POSTS to make the conditions @Mikedoouglas
– rubo