Need Help With This Basic Php - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Need Help With This Basic Php (2002 Views)
| Need Help With This Basic Php by Setag(op): 7:41pm On Jan 22, 2016 |
Let's say we're gonna be rolling a die: $die = rand(1, 6); Whilst the die is being rolled (the value of $die remains the same till user makes the right guess), the user tries to guess the value of the die. Program tells the user if the guess is higher (or lower) than the die value if guess is incorrect, program tells user how many times it took to guess the value of the die right if it took more than one turn to make the right guess. Immadiately user gets it right, game starts over again(the die is rolled again). |
| Re: Need Help With This Basic Php by hollyfat(m): 7:44pm On Jan 22, 2016 |
Setag:Get the value of $die and set it as a session variable. When the user get the answer, you reset the value |
| Re: Need Help With This Basic Php by hollyfat(m): 7:53pm On Jan 22, 2016 |
hollyfat:Try this
|
| Re: Need Help With This Basic Php by paranorman(m): 8:31pm On Jan 22, 2016 |
hollyfat:oga, there is no object in the form with the name 'guess', //second line of your php code. |
| Re: Need Help With This Basic Php by hollyfat(m): 8:48pm On Jan 22, 2016 |
paranorman:Check very well, it's in the submit button <input type="submit" name="guess" value="Guess!"> |
| Re: Need Help With This Basic Php by tgmservice: 9:00pm On Jan 22, 2016 |
Setag:try this guess = 0; $ die = rand(1,6); for($count = 1; $count <= 5; $count++){ if guess == 0{ echo "correct"; }break else{if count == 5{echo "game over";} |
| Re: Need Help With This Basic Php by paranorman(m): 2:08am On Feb 13, 2016 |
tgmservice:without even trying it out, I know it won't work! |
| Re: Need Help With This Basic Php by paranorman(m): 2:09am On Feb 13, 2016 |
hollyfat:you base a condition on a button?! I wouldn't do that though. |
| Re: Need Help With This Basic Php by paranorman(m): 2:11am On Feb 13, 2016*. Modified: 3:09am On Feb 13, 2016 |
cc: hollyfat |
| Re: Need Help With This Basic Php by Nobody: 4:42am On Feb 13, 2016 |
Oga o |
| Re: Need Help With This Basic Php by paranorman(m): 9:07am On Feb 13, 2016 |
dhtml18:bros, wetin happen na? |
| Re: Need Help With This Basic Php by Nobody: 4:54pm On Feb 13, 2016 |
I dey look all these codes and fear dey catch me? |
| Re: Need Help With This Basic Php by paranorman(m): 5:17pm On Feb 13, 2016 |
dhtml18:na basic code be this one na, noting pro at all. Na you be baba na |
Pls After Learning D Basic Php Wat Next? • Need Help On This Basic Php • Q-basic Program To Compute Simple Interest. • 2 • 3 • 4
Online Payment Plugin For Wordpress1 • Learn The Fundamentals Of Algorithms And Data Structures. • Course To Choose From. Niit Student Check This Out.