PHP Example
Screen shot
To enter number and change the background color.

<?php
if (isset($_POST['btn']))
{
$col=$_POST['t1'];
switch($col)
{
case 1:
$p='#ff0000';
break;
case 2:
$p='pink';
break;
case 3:
$p='#ffcc66';
break;
case 4:
$p='pink';
break;
case 5:
$p='#ffffff';
break;

default:
$p='#99ffcc';
}
}
?>
<html>
<head>
<title>back color</title>
</head>
<body bgcolor="<?php  if(isset($p)) echo $p; ?>">
<form name=""  method="post" >
Enter number to change bgcolor
<input type="text" name="t1">
<br>
<input type="submit" name="btn" value="Submit">
</form>
</body>
</html>

img4

You can download source code here