I’m working on a PHP Jeopardy game, I need a way to find out how to check if a link to a question has been clicked and hide it once it has.
I also need a way to refresh the gameboard to show all question links again.
Does anybody know how i can do this?
Edit:
The setup of my game is quite simple. Users do not have to register.
You are presented with a jeopardy board from which the questions are taken from a mysql database the questions and answers are stored using get (i didn’t want to have to make multiple sql requests). When you click on the question category (e.g. Category 1, $100) it will bring you to the page that will display the question on this page is a link back to the board and a link to the answer. On the answer page there is only the answer and a link back to the board page. (makes sense to me let me know if it doesn’t)
You can get a visited link with CSS. This is done through the so called pseudo-classes in CSS (more info on pseudo-classess here)So for CSS you can do something like:
And then if you want to show all the questions just do:
Big edit: There is no reliable way to do this with just CSS and JS with pseudoclasses. Seems that they are going to drop the support for the :visited property altogether from the browsers. Currently Chrome completely ignores styles for :visited links, except the color property. Even then, there is no way to sniff the color, because chrome lies and returns the color of the link, without applying the :visited rule.
Firefox still supports the :visited pseudoclass, but it seems that this will too be dropped soon.
So if you want to keep track of the links the user visited, you must use some combination of either javascript+cookies to track the visited links, e.g.:
Or you can use some AJAX to give the server information about the visited questions. That way you can achieve even more security (and cheat-prevention) by sending to the user just the questions he must see and do all the checks on the server-side, for example: