not too sure what the problem is, the syntax looks ok to me, try echoing out $alter to see if it is holding anything or use the empty($alter) to see if it is empty however i find it easier to use if statement, a little easier to keep track of what you are doing
<?
if ($alter == "17")
{
echo "under 18";
}
else if ($alter == "20")
{
echo "under 21";
}
else
{
echo "whatever your conditions are, you can if statement them";
}
?>