As I said previously, I would HIGHLY recommend just using "color.php?color=". In fact, that's what I'm going to help you code for.
OK, so, FIRST, we want to check if they clicked on a color in your dropdown, so grab the code I mentioned earlier:
$color = @$_GET['color'] ? $_GET['color'] : "";
Now, we can modify that a bit to check if they already have a cookie if they didn't use your dropdown:
$color = ((@$_GET['color']) ? $_GET['color'] : ((@$_COOKIE['color']) ? $_COOKIE['color'] : 'default_color'));
Change default_color to the color/style that will be defaulted to if they've never picked a color. Now, we know what color they want. Let's assign that to a cookie if they don't already have one.
if(!@$_COOKIE['color']) @setcookie('color', $color, time()+60*60*24*365) or echo 'There was an error setting the cookie.';
So far, we've:
- Established whether they used your dropdown to pick a color OR if they have a preset cookie.
- Established, via one of the above methods or by defaulting to a default you specified, which color to use.
Now, all that's left is to EITHER:
- Redirect to a color script (your blue.php, red.php, etc)
--- Do this by adding:
header("Location: $color.php");
or whatever the appropriate filename is.
OR
- Incorporate the color differences in this color.php, whether that be using a <style> to import a different CSS, or what.
Whew. Done. If you have any questions or are confused about anything, just reply to this thread as I'll stay subscribed to it until you MARK IT AS RESOLVED (please do this once we've worked out a solution).