Database Generated Drop Down List

Hi there,

New to the forums, and I use Kirupa allot, so thought I would come allong and join the discussions. :tb:

Basically, I am trying to make a drop down HTML form object read values of a certain database table and make them selectable. Here is what I currently have:

<?php
    require 'dbinc.php';
    
    $result = mysql_query("SELECT * FROM servers")
        or die(mysql_error());    
    
    <form action="adddomain.php" method="POST" enctype="text/plain">
        <select size="20" height="1">
            while($row = mysql_fetch_array( $result )) {
                echo <option value="echo $row ['name'];"</option>
            }
        </select>
        <input type="text" value="" name="servername" tabindex="2" />
        <input type="text" value="" name="serverip" tabindex="3" />
        <input type="text" value="" name="admuser" tabindex="4" />
        <input type="text" value="" name="admpass" tabindex="5" />
        <input type="submit" value=""/>
    </form>
    
    $serverid = $_POST["serverid"];
    $servername = $_POST["servername"];
    $domainid = $_POST["domainid"];
    $domainname = $_POST["domainname"];
    $nsbool = $_POST["nsbool"];
    $nserver1 = $_POST["nserver1"];
    $nserver2 = $_POST["nserver2"];
    $wwwrecord = $_POST["wwwrecord"];
    $mailrecord = $_POST["mailrecord"];
    $ftprecord = $_POST["ftprecord"];
    
    /**
* variable nsbool defines whether the records on a particular domain are directed using name servers or just specific records - 1 equals specific records whereas 0 equals nameservers in use only
*/
    
    mysql_query("INSERT INTO domains (serverid, servername, domainid, domainname, nsbool, nserver1, nserver2, wwwrecord,                mailrecord, ftprecord)
        VALUES('$serverid', '$servername', '$domainid', '$domainname', '$nsbool', '$nserver1', '$nserver2', '$wwwrecord'                ,'$mailrecord', '$ftprecord') ") 
        or die(mysql_error());
?>

I understand things are a little messed up here, but you should get the idea of what I am doing. Has anyone done this and what method did they use to achieve the desired results?

Thanks! :book: