Hi I'm trying to create a select menu populated from a MySQL database, I can create the menu without any problems however when I try to add a IF statement for form validation purposes I keep getting T_String error.
The code I'm using is as follows:
Can anyone take a look, and see what I'm doing wrong! I've played around with this bit of code for ages, and I fell like I'm going round in circles herePHP Code:$siteslist_query = mysql_query("SELECT userid, sitename FROM sites WHERE approved=1");
while ($siteslist = mysql_fetch_array($siteslist_query)){
if ($fields["siteid"] == '$siteslist['userid']'){
$selected = 'selected';}
$siteslist_echo .= '<option value"'.$siteslist['userid'].'">'.$siteslist['sitename'].'</option>';
$siteslist_echo .= "\n";
}
![]()



Worked a treat!

Bookmarks