Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.