pooker Posted June 16, 2008 Share Posted June 16, 2008 I want a dropdown list to display the information from my sql database, that way when it reads a table it will display that information in the dropdown menu. The dropdown menu displays but no information displays, there is data in the database also. I have them saved as char's with max of 50. <?php include('config1.php'); mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $list = mysql_query("SELECT value,title FROM $db_name"); ?> <form action="action.php" name="form1" method="post"> <select name="option"> <?php while ($row_list = mysql_fetch_assoc($list)) { ?> <option value="<?php echo $row_list['value'] ?>"> <?php echo $row['title'] ?></option>; <?php } ?> </select> <input type="submit" name="Submit" value="select"> </form> Link to comment https://forums.phpfreaks.com/topic/110409-solved-help-with-dropdown-list/ Share on other sites More sharing options...
.josh Posted June 16, 2008 Share Posted June 16, 2008 $list = mysql_query("SELECT value,title FROM $db_name"); change $db_name to your table name. Link to comment https://forums.phpfreaks.com/topic/110409-solved-help-with-dropdown-list/#findComment-566438 Share on other sites More sharing options...
pooker Posted June 16, 2008 Author Share Posted June 16, 2008 Thanks, I feel stupid, gotta start soemwhere I guess. :-\ Link to comment https://forums.phpfreaks.com/topic/110409-solved-help-with-dropdown-list/#findComment-566439 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.