Well, not exactly a Conundrum, more of a simple problem that I have not much of an idea of how to do.

So my friend has a PHP Assignment due tonight, and we've been googling how to make an image go from invisible to visible using PHP to no avail.

Basically we need to create a Yahtzee game (well, our assignment was A game, and the default was Yahtzee, I'm making a text adventure game which is going along quite well I think! ) and to do this we will need to create a button which both makes and displays only the numbers/dice rolls that the player selects to appear (the others remain static to a previous "roll"), random numbers which select which picture of a dice needs to appear. Then we need these dice roll numbers to be selected by other elements such as radio buttons or perhaps buttons if they fulfil certain elements.

So I guess some pseudo code to explain what I'm talking about is required!

PHP Code:
if isset button["rolldice"]
$diceroll1 rand(1,6);
$diceroll2 rand... etc.

print 
$diceroll1;
Print 
$diceroll2//like that except formatted of course in the right place 
Then some code for the rest of the buttons and stuff, but quite honestly I have no idea where to go from here!

Some I'll sum this up and place some specific numbered questions I would LOVE some people to help me with!

  1. How would we make a button create some random numbers, and then print them. Is the "isset" thing viable, and if so, what is the correxct syntax for that?
  2. How do we make the same button make images appear that correlate with the number, for example if $diceroll1 is 4, then the picture of the dice with a 4 on it is displayed in a certain location?
  3. I understand the sort of equations we'll need to do for Yahtzee, but I don't know how to make the buttons implement these equations and interact with variables. Is it the isset thing again, and if so, how?
  4. How do I make a button a "One off" button, that resets after another "New Game" button is placed?


Just answering part of a question or even just asking for clarification is fine, would really appreciate any form of help here.

Thanks guys! Happy posting!