How would I go about having placeholder divs that are then “overwritten” later with PHP?
I want to have 6 placeholder divs for strikes, so to speak, in a game.
[ ] [ ] [ ] [ ] [ ] [ ].
Which will be white squares with a black border.
After they make a bad guess, I want the first div to be overwritten with a red box holding the guess. Basically the above, but fully red and a number in the middle. ex:
How would I go about doing this with PHP/CSS/HTML? I'm totally used to echo statements, so I was thinking about echoing each one out. But if I had divs there to begin with, it would just go after them, not overwrite.
I was thinking something along the lines of background images, at least in concept (not actual images) where the new guesses just go overtop the old ones. Would that be the best way?
PHP completes all data at DOM complete. To update the DOM in real time, you can either use Ajax or your own JS block, node.js, etc.