if (substr($taula_motius[$counter],0,1) != " ") { echo '</optgroup> <optgroup label="'.$taula_motius [$counter].">"; }