TimUSA Posted January 4, 2008 Share Posted January 4, 2008 I have this code for a dropdown list, how would i change it so that the names are displayed but the value = the ID_MEMBER #? $query = "SELECT `memberName` , `ID_MEMBER` FROM `smf_members` WHERE `ID_GROUP` IN (1, 9, 10, 11, 13) ORDER BY `memberName`;"; $result = mysql_query($query); echo' <SELECT id="name" name="name" style="WIDTH: 160px" value ="'; echo '" />'; if(mysql_num_rows($result)) { // we have at least one user, so show all users as options in select form while($row = mysql_fetch_row($result)) { print("<option value=\"$row[0]\">$row[0]</option>"); } } else { print("<option value=\"\">No user in this group</option>"); mysql_data_seek($result, 0); } Link to comment https://forums.phpfreaks.com/topic/84420-dropdown-list-question/ Share on other sites More sharing options...
rajivgonsalves Posted January 4, 2008 Share Posted January 4, 2008 this print("<option value=\"$row[0]\">$row[0]</option>"); should be print("<option value=\"$row[1]\">$row[0]</option>"); Link to comment https://forums.phpfreaks.com/topic/84420-dropdown-list-question/#findComment-430027 Share on other sites More sharing options...
TimUSA Posted January 4, 2008 Author Share Posted January 4, 2008 thanks Link to comment https://forums.phpfreaks.com/topic/84420-dropdown-list-question/#findComment-430029 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.