I want to display the results of a game that is played when a button is clicked, but I only want them to show once the button is clicked, and not before, when the page is first loaded.
<div class="container text-center border border-primary rounded">
<h1 class="container "> What are the Odds!?!</h1>
<div class="col-sm">The game of definite uncertainty!</div>
<?php
$random = rand(1,2);
$random2 = rand(1,2);
?>
<div class="text-center">
<div class="text-primary">Player1:<?php echo $random; ?></div><div class="text-danger">Player2:<?php echo $random2; ?></div>
</div>
<br>
<div>
<?php
if($random ==1 && $random2 ==1){
echo "Player 1 WINS!!!";
}elseif($random ==2 && $random2 ==2){
echo "Player 1 WINS!!!";
}else{
echo "Player 2 WINS!!!";
}
?>
</div>
<br>
<button onclick="location.reload();">Start!</button>
</div>