lundi 3 juillet 2017

php if statement only allow 3 attempts

I have a question that a user needs to answer. I only want to give them 3 times to answer the question. using cookies or session is not allow. Please help me code this

$answer= $_Post["ans"];

if($answer is answered wrong 3 times){
    echo "you have reached the max tries to answer this question";
} else{
    echo "You answer the question correctly";
  }

Aucun commentaire:

Enregistrer un commentaire