-
November 15th, 2012, 11:46 PM
#1
PHP Conundrum
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!
- 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?
- 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?
- 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?
- 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!
-
November 16th, 2012, 12:06 PM
#2
Re: PHP Conundrum
Such an assignment makes no sense. PHP is a server-side language. Button interaction can only be done through submitting of form data or URL variables. Unless this is intended to be an online multiplayer project...this is a horrible project implementation.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|