Jump to content

[SOLVED] help with dropdown list


pooker

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.