adzie Posted August 9, 2007 Share Posted August 9, 2007 Hi peeps, I'm looking to create a drop down box that displays a field from a a mysql DB so that i can list all the names and when I select a name from the list it selects that record Quote Link to comment https://forums.phpfreaks.com/topic/64111-dropdown-populated-from-mysql-field/ Share on other sites More sharing options...
Orio Posted August 9, 2007 Share Posted August 9, 2007 Something like this? <?php //Connect to db $query = "SELECT name FROM names_tbl"; $result = mysql_query($query); echo "<select name=\"names\">\n"; while($row = mysql_fetch_array($result)) echo "<option name=\"".$row['name']."\">".$row['name']."</option>\n"; ?> Orio. Quote Link to comment https://forums.phpfreaks.com/topic/64111-dropdown-populated-from-mysql-field/#findComment-319513 Share on other sites More sharing options...
adzie Posted August 9, 2007 Author Share Posted August 9, 2007 spot on Cheers orio. Is there a way that when I select a name from the list that it can prompt a from I've already created to open showing all that persons details? thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/64111-dropdown-populated-from-mysql-field/#findComment-319533 Share on other sites More sharing options...
Orio Posted August 9, 2007 Share Posted August 9, 2007 I dont understand you- cant you write some code on your own? If you run into troubles in the way, post here. But this is not a "Script on Demand" board. Try the freelancing forum in that case. Orio. Quote Link to comment https://forums.phpfreaks.com/topic/64111-dropdown-populated-from-mysql-field/#findComment-319549 Share on other sites More sharing options...
adzie Posted August 9, 2007 Author Share Posted August 9, 2007 sorry orio, I have tried various ways and not succeeded. Quote Link to comment https://forums.phpfreaks.com/topic/64111-dropdown-populated-from-mysql-field/#findComment-319551 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.