make a product select menu (instead of a submit button, you can do onChange=submit()😉:
<select size=1 name=id_product onChange=submit()>
the second select is displayed only if something was chosen from the first one:
if($id_product != '')
{
?>
<select size=1 name=id_project onChange=submit()>
<?
}
as for the options of this select:
$sql = "select id,name from projects where id_product=$id_product";
this is the connection to the choice done in the first select.
and so on ... got it?