Aug 152012
 

Simple presentation of php random function – http://flip-coin.goodplace.eu/

Flip coin

Page is refreshed after click on the Button. Picture of Coin is loaded according to results of random function.

How its made
Code:

...
<input type="button" value="Flip !" onClick="window.location.reload()">
...
<?php
if (rand(0,1) == 0) {
echo "<img src=\"1eurohead.jpg\" alt=\"Head\" title=\"Head\" border=\"0\" height=\"225\" width=\"225\">";
}
else {
echo "<img src=\"1eurotail.jpg\" alt=\"Tail\" title=\"Tail\" border=\"0\" height=\"225\" width=\"225\">";
}
?>
...