即時通訊新的PHP和我不能讓我的程序正確顯示。如果代碼不工作,我沒有得到像偉大的工作,你很好的文本! 我只是想做一個簡單的猜謎遊戲,你猜的數字,你會看到如果你猜猜正確的數字確定隨機數。PHP滾動骰子猜測
這裏是我的代碼(php.html)
<html>
<head>
</head>
<body>
<form name = "Dice roller" action="game_check.php" method="post">
Your guess: <br>
<input type= "text" name="" size= "1">
<input type ="submit" name = "submit">
</form>
</body>
</html>
Game_check.php
<html>
<body>
<?php
$roll = $_POST['submit'];
$dice = rand(1, 6);
if ($roll == 1 && $dice == 1)
{
print "Great Job, You're Good!";
}
else if ($roll == 1 && $dice /= 1)
{
print "Wrong"; <br >
}
if($dice == 1) print "<img src='1.png'>"."<br>";
if($dice == 2) print "<img src='2.png'>"."<br>";
if($dice == 3) print "<img src='3.png'>"."<br>";
if($dice == 4) print "<img src='4.png'>"."<br>";
if($dice == 5) print "<img src='5.png'>"."<br>";
if($dice == 6) print "<img src='6.png'>"."<br>";
else {
print "Thanks". "<br>";
}
?>
<form name= "Back" action= "php.html" method= "post">
<input type="submit" name="back" value ="Play again">
</form>
</body>
</html>
我有一個循環,如果爲6個骰子.. 謝謝
我給,我贏了;這是比賽嗎? –
* Hm ... *'/ ='<= wha'dat? –
是的,你的if語句使得它只有在roll爲1時才能贏,即使你猜對了。我也不認爲'/ ='是你正在尋找的操作符,但我不知道PHP,所以誰知道。 – pseudonym117