Codice PHP:
<?php
rand();
$random1 = rand(0, hexdec("ffffff"));
$random2 = rand(0, hexdec("ffffff"));
echo "<input type=\"text\" name=\"nome\" size=\"20\" style=\"background-color: #$random1\" />";
echo "<input type=\"password\" name=\"password\" size=\"20\" style=\"background-color: #$random2\" />";
?>
FFFFFF è un avlore esadecimale che rappresenta (spero lo saprai) la percentuale di rosso, verde e blu nel colore usato, ognuno con una gradazione da 0 a 255 (FF in esadecimale, la notazione usata nell'esempio).