Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    CSS
    CSS is offline
    New Coder
    Join Date
    Jun 2006
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with... nullifying a field, I guess?

    Ok. First and foremost, I am very, very new to PHP. I can't script from scratch, I can edit just fine, and I managed to get a template for a game that I play and I am working on making a script to report 'best out of 3 games.' My problem is, if a player wins their first 2 matches, the third match results field still shows. How can I prevent this? I can attach the two pages, I'm not sure how else to explain this!
    Attached Files Attached Files

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts

    Post

    You can actually imbed PHP code anywhere in the html you want. So you could do something like this:

    Code:
    <html>
    <body>
    
    <p>Match results:</p>
    <p>
    <?php
    for ($i = 0; $i < count($matchResults); $i++) {
        if (isset($matchResults[$i])) {
            print "Results from Match 1:  {$matchResults[$i]}!<br>\n";
        }
    }
    ?>
    <p>End of results!</p>
    </body>
    </html>
    I just made up the details of the code-- I don't expect you'll be able to just cut and paste it. It's the concept that's important here. Everything between <?php and ?> will be processed by PHP before the page comes back to your browser and all you'll see is the results from the print statement.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •