Page 1 of 1

Populating A Dropdown List Via MS Access

Posted: Sat Dec 05, 2009 3:22 pm
by bishmedia
Ok mr Newbie here is trying to populate a dropdown list, but it wont populate, here is the code so far.......

Code: Select all

 
                      <div class="pageheader">Warehouse Property Page</div><br />                       
                        <?php  require_once('../App_Data/odbc_open.php');
                            $query = odbc_exec($odbc, "SELECT DISTINCT country FROM sheds") or die (odbc_errormsg()); ?>                            
                            <form action="action" method="post">
                            <select name="option"> 
                            <?php while($row = odbc_fetch_array($query))
                            {
                            echo "<option value='$row[country]'>";
                            }
                            odbc_close($odbc);   ?>
                            </select>
                            </form>
                      </div
 
Can someone tell me how stupid l am and correct this? :-)

Bish

Re: Populating A Dropdown List Via MS Access

Posted: Sat Dec 05, 2009 4:08 pm
by bishmedia
Someone sorted it for me on another site......

echo "<option value='$row[country]'>$row[country]</option>";

many thanks anyway :-)