i have this code to create a select list in drupal dynamically.
$res = db_query("select field1 from content_type_1");
while($row = db_fetch_array($res)){
$rows[] =$row['field1'];
}
return $rows;
output is like:
<select>
<option value="0">row['field1']</option>
</select>
i need output like this
<select>
<option value="row['field1']">row['field1']</option>
</select>
how to do this?
Not sure about it, but I suppose that drupal :
valueattribute,<option>.If it’s the case, changing your loop to this could help :
Now, for each item of the
$rowsarray, the key is the same as the value.