Hi,
I am trying to write a simple little number guessing game for a continuing
education class project. (file name: guessing2.php). I have nearly got it
working, but 3 things do not appear to be working right:
When I execute this, once you guess the number right, I bring up a radio form to
ask the user if they want to play again. When this happens, the script still
seems to continue to run and goes to the next code block which again outputs the
"Your Guess" prompt and its related form.
This should not be happening, as I have set the following variables to stop the
code from continuing into the game
When I test to see what the variables are at this point, the value for
$submitClick2 is true and $playAgain is blank. Now, I don't know why $playAgain
is blank, but since neither value meets this criteria it should not process the
script, but it does.
Perhaps this has something to do with $playAgain being blank -- but I don't know
why its blank. In the Play Again script, I then change $playAgain to true. (Once
the Play Again radio button selection is select as yes, then I post the value of
true to $playAgain -- but this should have no effect on the current issue I am
having as at this point, the form submit button for Play Again has not been
pressed).
What is going wrong?
Why is $playAgain blank?
Why does the game not end when I press "no"? This should meet the conditions I
have at the end of the game.
I would appreciate any help or insight anyone could give on this.
Please help.
Thanks!
I didn't find the right solution from the Internet.