has extra blank 's and I have no idea why. please help me get them out This is the result of the code it has extra option tags no idea why.

I have no idea why It produces the extra option box. 

Below is the result of the query. Correct number of rows correct response...

     ParentID   Parent
    1   Pipe
    2   Valve
    3   Control Valve
    4   Pump
    5   Chamber
    6   Meter
    7   Check
    8   Distribution Pipe


This is some php that makes the dropdown:

$qry = "select distinct ParentID, Parent from tbl
    where ChildID = '0' and Parent is not null";

$parentRslt = mysql_query($qry);

$count = mysql_num_rows($parentRslt);

$opt7 = null;

for($m=0;$m&lt;$count;$m++)
    {
        $var = mysql_result($parentRslt,$m,'ParentID');
        $name = mysql_result($parentRslt,$m,'Parent');

        $var = trim($var);
        $name = trim($name);

        $opt7.="&lt;option value='$var'&gt;$m $name&lt;option&gt;";
    }


$form = "
    &lt;form method='post'&gt;

    Network Action: &lt;input type='text' name='child' /&gt;  
    &lt;select name='parentID'&gt;
            $opt7
    &lt;/select&gt;

    &lt;input type='submit' name='submit' value='submit' /&gt;&lt;/form&gt;";

return $form;
You should close the option tag. Change

$opt7.="&lt;option value='$var'&gt;$m $name&lt;option&gt;";


to

$opt7.="&lt;option value='$var'&gt;$m $name&lt;/option&gt;";