$username Posted January 23, 2008 Share Posted January 23, 2008 Hello all, I am looking to have a drop down box populated from data from MySQL. I would like to have first name and last name in the value. Is there something I am doing wrong? echo "<option value=\"{.$row150['UserFirstName']..$row150['UserLastName'].}\"{$selected}>{$row150['UserFirstName']}</option>"; $sql150 = "SELECT UserFirstName, UserLastName FROM users"; //$sql150 = "SELECT CompState FROM standardvalues"; if ($result150 = mysql_query($sql150)) { while ($row150 = mysql_fetch_assoc($result150)) { $selected = ($row150['UserFirstName']==$ContactState)?" selected=\"selected\"":""; echo "<option value=\"{.$row150['UserFirstName']..$row150['UserLastName'].}\"{$selected}>{$row150['UserFirstName']}</option>"; } } echo " </select> </div></td> Thanks Brett Quote Link to comment https://forums.phpfreaks.com/topic/87312-solved-drop-down-box-with-info-from-mysql/ Share on other sites More sharing options...
revraz Posted January 23, 2008 Share Posted January 23, 2008 When you View Source, how does it display? Quote Link to comment https://forums.phpfreaks.com/topic/87312-solved-drop-down-box-with-info-from-mysql/#findComment-446581 Share on other sites More sharing options...
$username Posted January 23, 2008 Author Share Posted January 23, 2008 Right now it does not display just shows blank if I do this it works echo "<option value=\"{$row150['UserFirstName']}\"{$selected}>{$row150['UserFirstName']}</option>"; thanks, Brett Quote Link to comment https://forums.phpfreaks.com/topic/87312-solved-drop-down-box-with-info-from-mysql/#findComment-446585 Share on other sites More sharing options...
revraz Posted January 23, 2008 Share Posted January 23, 2008 Now add your second variable right after it the exact same way. Quote Link to comment https://forums.phpfreaks.com/topic/87312-solved-drop-down-box-with-info-from-mysql/#findComment-446587 Share on other sites More sharing options...
$username Posted January 23, 2008 Author Share Posted January 23, 2008 Thanks that did the trick Brett Quote Link to comment https://forums.phpfreaks.com/topic/87312-solved-drop-down-box-with-info-from-mysql/#findComment-446884 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.