3
I need to show all errors in filling out the form first to then run FOR, but if using DIE for each IF will stop the script and will not show if there is any extra error, which way to do this?
if($parcelas == 0){
echo "Digite valor acima de 1 parcela para gerar<br>";
}
if($valor == 0){
echo "Digite valor acima de 0 para gerar<br>";
}
if($vencimento) {
function validateDate($date, $format = 'd-m-Y')
{
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
}
if (validateDate($vencimento,'d/m/Y') == false){
echo "Digite a data de vencimento corretamente DIA/MÊS/ANO<br>";
die;
}
}
///Executar o for abaixo
for($i =0, $x = 1 ;$x <= $parcelas, $i <= $parcelas; $x++ ,$i++ ){}
Don’t do this on the server side, do it on the client side. It’s faster, using jQuery or Javascript. Or it needs to be on the server side ?
– Diego Souza
On hand? I can’t even remember how to do it in PHP ;)
– Wallace Maxters
there is more practical way @Wallacemaxters ?
– Angel
More practical, taking into account the structured system, would be Edilson’s response
– Wallace Maxters