Hello
I am new in php working on online exam type webapplication my client requirement is this durring the test the user cant move backward or cant press the back button of browser

how can i control it
there are few javascripts i try but they not working if user disable the javascript

please tell me solution for this

I suggest a few steps; but if Javascript is disables, part of this will fail.
1. open the app as new pop-up window without menu/toolbars etc. (need JS)
2. disable right click (using JS)
3. disable back key (using JS, causes bad user experience)
4. Add "Expires" to HTML headers of each page that should be backed
However, on second thought, why not keep track of what questions are already answered, on server (may be session may be database) so that questions cannot be re-submitted.

Hope the discussion helps

Since PHP is server-side, it can't actually disable the back button, all you can really do with it is prevent that data is lost when people do, sometimes.

This can be solved with a php session, saving the question to the session, and using a database/array/file to load the next question on the same page (or hidden POSTS using forms on the next buttons).
This way, when they try to go back, they receive the same question (as saved in the session or in the form...) if there is not cookie or form, it goes back to the 1st question.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.