Using Dreamweaver, how can I populate a drop down list via PHP?

madelinecrane

New Member
I am trying to populate a drop-down list via PHP embedded in HTML... I am a complete noob to all this markup stuff and php as well, so please be patient with me lolHere is what I have so far:\[code\] <select name="ChapterList" id="ChapterList" style="width:120px;"> <?php $username = "xxxxxxxxxxx"; $password = "xxxxxxxxx"; $database = "xxxxxxxxxxxxxx"; $host = "xxxxxxxx.mydomainwebhost.com";@mysql_connect($host, $username, $password) or die("Unable to connect to database");@mysql_select_db($database) or die("Unable to select database");$query = "SELECT * FROM Chapters ORDER BY Id";$ListOptions = mysql_query($query);while($row = mysql_fetch_array($ListOptions)){ echo "<option value='".$row['Id']."'>".$row['ChapterName']."</option>"} ?> </select>\[/code\]I know I am recieving the expected results because if I \[code\]echo $row['ChapterName'];\[/code\] , the current values I have in the database are listed in the proper order...So why is it when I \[code\]echo "<option value='".$row['Id']."'>".$row['ChapterName']."</option>"\[/code\] my list receives nothing at all?Any help is greatly appreciated... I have been trying to fix this list for two days now...
 
Back
Top