what format are you allowing them to choose the color in? are they presenting the HEX value, or are they actually providing you with an RGB value?
basically, here's how i'd handle the individual squares: have a file called image.php that will generate your colors based on the query string. for each square you need, pass it an r, g, b value. then, you could call that file as an <img> for each of your colors in that given color scheme. for instance:
// here is your image.php file
$r = isset($_GET['r']) ? $_GET['r'] : 255;
$g = isset($_GET['g']) ? $_GET['g'] : 255;
$b = isset($_GET['b']) ? $_GET['b'] : 255;
$img = imagecreate(20, 20);
$background = imagecolorallocate($img, $r, $g, $b);
header ("content-type: image/png");
imagepng ($img);
imagedestroy ($img);
notice that if no arguments are passed, it doesn't die, it simply defaults to white. then, if i wanted to show a full Red, Blue, and Green box as options, i'd do the following on a page:
<table>
<tr>
<td><img src='image.php?r=255&g=0&b=0' /></td>
<td><img src='image.php?r=0&g=255&b=0' /></td>
<td><img src='image.php?r=0&g=0&b=255' /></td>
</tr>
</table>
notice that you could easily populate the query string via PHP as well.
hope this helps