jeudi 16 avril 2015

How can I count and limit form submission?

I have a form that submits data to a mysql database. Once the form has been submitted it reloads and the user fills in the form and submits again over and over (They are being presented with different questions each time).


I want to limit the amount of times the user can submit the form to 3 before the user is headed to another page (results). I'm not sure how to go about achieving this. I have created a counter that logs each time a user submits the form in my database (code below) but I don't know what to do now. I am not using ajax. I'd really appreciate any help.



$sql="UPDATE counter SET counter = counter + 1 WHERE id=$id";
mysqli_query($con, $sql);

Aucun commentaire:

Enregistrer un commentaire