[eluser]Markie577[/eluser]
Hi People!
Wondering if someone could help with a problem I can't get my head around!
I want output a select field which gets its data from a database
this is the code
Code:
$options = '<select name="cities" id="cities">';
foreach($data->result() as $row)
{
$options .= '<option value='$row->sort_id'>'$row->name_city;'</option>';
}
$options .= "</select>";
echo $options; // this will be received by your jQuery script
The option variable within the foreach loop is the one that gives me trouble!
I get a Parse error
Parse error: syntax error, unexpected T_VARIABLE with that option field!
If I would delete that option variable and echo $row->name_city it will work!
anyone know what this can be?
Sincere thanks