PDA

View Full Version : Help with... nullifying a field, I guess?



CSS
06-22-2006, 12:35 AM
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!

Fumigator
06-22-2006, 05:26 AM
You can actually imbed PHP code anywhere in the html you want. So you could do something like this:



<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.