使用js和php设置并显示表单的倒数计时器

I have an exam form. i want to set and show a countdown timer (for example 60 minutes) as the student open the page. if they post the form after that specific time it wont be acceptable and they lose the exam.

how can i do that? only using js or need using php as well?

i'm a new so need some clear codes!

Thanks

Consider using a database for this or some kind of server-side check. When the student opens the test for the first time, the time should be stored in a database and the shown time should be calculated. Otherwise refreshing the page would reset the timer. At the end if the time of submitTime-startTime < 60 seconds then he/she made it in time.

This means that you need PHP for example. It should call a method which stores the current time if a field in database if it isn't allready stored and then do the same after submit. If the time of submit is present in the database, you shouldn't allow him/her to do the test again.

JavaScript should only be used for the display of time, not for validity checking alone without any server-side checking.