Get up to 80 % extra points for free! More info:

Discussion: Why is my variable showing as blank?

Activities
Avatar
JensenBreck
Member
Avatar
JensenBreck:12/1/2017 6:36

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.

References:https://www.codingforums.com/…g-blank.html?…

Corporate Promotional Video

 
Reply
12/1/2017 6:36
Avatar
Replies to JensenBreck
David Capka Hartinger:12/1/2017 8:50

Can you attach your source code please?

Up Reply
12/1/2017 8:50
You can walk through a storm and feel the wind but you know you are not the wind.
To maintain the quality of discussion, we only allow registered members to comment. Sign in. If you're new, Sign up, it's free.

2 messages from 2 displayed.