PHP dice roll - urgent help needed?

Colly

New member
so i have this practice practical that i would need to understand before i start the actual exam. but i cant get it to work. here's what i have so far
<html><head><title>Mark Checker</title></head>
<body>

<?php

$one=0;
$two=0;
$three=0;
$four=0;
$five=0;
$six=0;

for($i=1;$i<=20;$i=$i+1) {

$roll = rand(1,6);

if ($roll == 1) {
$one=$one + 1;
}
elseif($roll == 2) {
$two=$two + 1;

elseif ($roll == 3) {
$three=$three + 1;
}
elseif($roll == 4) {
$four=$four + 1;

elseif ($roll == 5) {
$five=$five + 1;
}
elseif($roll == 6) {
$six=$six + 1;
}

}

print "number of 1 rolls is $one<br>";
print "number of 2 rolls is $two<br>";
print "number of 3 rolls is $three<br>";
print "number of 4 rolls is $four<br>";
print "number of 5 rolls is $five<br>";
print "number of 6 rolls is $six<br>";

?>
</body>
</html>



this is the code i have for the form page:

<html>

<head>
<title>Guess</title>
</head>


<body>
<form action= "diceroll.php" method="post">


<h1>Enter Your Guess<h1>


<br>
grade:<input type="text" Size="16" maxlength = "3" Name= "roll">


<p>
<input type ="submit" value="click to submit">
</p>


<p><input type="reset" value="erase and restart">
</p>


</form>

</body>

</html>

can someone help me out here.......its been frying my brain for the last couple of hours
 
Back
Top