Input PHP Variable into HTML Select Tag
I have a php variable ($list) that is a list of values separated by commas.  I am trying to figure out how to convert or input this variable into a HTML select tag.  Here is what I have so far:

    $dbquery = @$db->query('SELECT * FROM Company');
    while ($queryText = $dbquery->fetchArray()){
      $array[]=$queryText['Company_Name'];
    }
    //the next batch of code, which is not included, converts the $array[] into a variable named $list//  
    //the values for $list are: Company1, Company2, Company3, Company4...//

    //HTML select tag//
    echo '<select name="testSelect" id="testId">';
    echo '<option value="'.$list.'">'.$list;
    echo '</option></select>';

I understand that I would need a loop like a "while" or a "for" to list the values within $list, but I am not sure of the exact syntax.  Can anyone assist me with this?

Thanks,

DFM



 
Input PHP Variable into HTML Select Tag
===

I have a php variable ($list) that is a list of values separated by commas.  I am trying to figure out how to convert or input this variable into a HTML select tag.  Here is what I have so far:

    $dbquery = @$db->query('SELECT * FROM Company');
    while ($queryText = $dbquery->fetchArray()){
      $array[]=$queryText['Company_Name'];
    }
    //the next batch of code, which is not included, converts the $array[] into a variable named $list//  
    //the values for $list are: Company1, Company2, Company3, Company4...//

    //HTML select tag//
    echo '<select name="testSelect" id="testId">';
    echo '<option value="'.$list.'">'.$list;
    echo '</option></select>';

I understand that I would need a loop like a "while" or a "for" to list the values within $list, but I am not sure of the exact syntax.  Can anyone assist me with this?

Thanks,

DFM



 