ifConditional.php
Source of ifConditional.php
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>ifConditional</title>
</head>
<body>
<h1>Dice Rolling Game</h1>
<p>Welcome to the dice rolling game. See if you can roll a six!</p>
<?php
$userNumber = rand(1,6);
if($userNumber){
print "<p><img src=\"die$userNumber.png\" /></p>";
if($userNumber == 6){
print "<p>You rolled a six!</p>";
}
}
?>
<p><a href="ifConditional.php">Try Again!</a></p>
</body>
</html>