CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: PHP Conundrum

  1. #1
    Join Date
    Nov 2012

    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.

    $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!

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002

    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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.