If you want to do it all serverside, you could write your form so that at first it displays the Product option. When you click submit, you will then be prompted with the colour selection.
basically like this (if the form posts to itself):
if($product)
{
display colour selection
}
else
{
display product selection
}