drop down value is not appearing in the drop downlist : I have a php code the add delete new row to the html table. Once column has text field and second column has a drop down. Its value is coming from mysql database.
First row is coming correctly. But the value in second record dropdown list is misssing.
please help

code is: 

    <html>
      <head>
        <title></title>
        <style type="text/css">
    input {
      display: block;   /* makes one <input> per line */
    }
        </style>
      </head>
    <?php
    include 'dbconnection\dbconnection.php'; // Database connection
    
    
    
    
    
    $count=1;
    if(isset($_POST['btnadd']) == "ADD NEW ITEM") {
    // add 1 to the row counter
        if (isset($_POST['count'])) $count = $_POST['count'] + 1;
    // set value for first load
        else $count = 1;
    }
    if(isset($_POST['btnremove']) == "DELTE ITEM") {
    // decrement the row counter
        $count = $_POST['count'] - 1;
    // set minimum row number
        if ($count < 1) $count = 1;
    }
    ?>
      <body>
    
    <!-- call same file on submit -->
        <form name="form1" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    	  
     
     <?php 
     $cdquery="select cmc_id,cmc_name from cat_main_category";
    $result2=mysqli_query($conn,$cdquery) or die(mysqli_error());
     echo ' <table>';
    // print $count rows
    
    
    for ($i=1; $i<=$count; $i++) {
    echo ' <tr>  <td>     <input type="text" name="text'.$i.'" align="center">  </td>';
    echo '<td> <select id="basicgroup'.$i.'" name="basicgroup'.$i.'" onchange=reload(this.form)>';
    echo '<option value=0>Select</option>';
    
    while ($row=mysqli_fetch_array($result2)) {
             $cdTitle=$row["cmc_name"];
    			$id=$row["cmc_id"];
    			//if($id==@$basicgroup){
                    echo "<option selected value=$id>
                        $cdTitle
                    </option>";
    			/*}
    			else{echo "<option value=$id>
                        $cdTitle
                    </option>""."<BR>";;*/}
                
               
    echo '</select></td></tr>	';		
    	 }		
    ?>
    
    
    
    </table>
    
     <!-- you only need one set of buttons and only one counter for this script
          because every button would do the same -->
          <input type="submit" name="btnadd" id="btnadd" value="ADD NEW ITEM" >
          <input type="submit" name="btnremove" id="btnremove" value="DELETE ITEM">
          <input type="hidden" name="count" value="<?php echo $count; ?>">
    	  
        </form>
      </body>
    </html>