I need a button in php to change my background color every 5 presses with a random one, every five presses the color have to change once and need to stay for the next 5 presses. here is my code <head>
<title>click 5 times</title>
<?php
$a=array(0,1,2,3,4,5,6,7,8,9,"a","b","c","d","e","f");
$culoare="#";
for($i=1; $i<6;$i++)
$culoare.=$a[rand(0,16)];
session_start();
$_SESSION['counter'] = isset($_SESSION['counter']) ? $_SESSION['counter'] : 0;
if($_POST['sub']) {
$_SESSION['counter']++;
echo "<br/>";
echo $culoare;
echo "<body bgcolor='<?phpecho $culoare;?>'></body>";
}
?>
</head>
<body >
<form action='' method="post">
<input type="submit" name="sub" value="click" />
<input type="hidden" name="counter" value="<?php print $_POST['counter']; ?>" />
</form>
</body>