Populating drop down box
Posted: Wed Jul 21, 2010 6:31 am
I am trying to populate a drop down box from mysql database but for some reason i am getting nothing there are no errors
here is my code
<?php
$con = mysql_connect("localhost","dbuname","tdbpassword");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("DBname", $con);
echo "<select name=Store Location=''>Store Location</option>";
$query = "SELECT StoreLocation FROM Stores";
$result = mysql_query($query);
echo "<select name =stores value=''>loaction</Option>";
while($nt=mysql_fetch_array($result)){
echo "<option value=$nt[Storelocation]></option>";
}
echo "</select>";
/*while($row = mysql_fetch_array($result))
{
echo "<option value=$row[StoreLocation]></option>";
echo "</select>";
}*/
mysql_close($con);
?>
any help is apreciated thanks in advance
here is my code
<?php
$con = mysql_connect("localhost","dbuname","tdbpassword");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("DBname", $con);
echo "<select name=Store Location=''>Store Location</option>";
$query = "SELECT StoreLocation FROM Stores";
$result = mysql_query($query);
echo "<select name =stores value=''>loaction</Option>";
while($nt=mysql_fetch_array($result)){
echo "<option value=$nt[Storelocation]></option>";
}
echo "</select>";
/*while($row = mysql_fetch_array($result))
{
echo "<option value=$row[StoreLocation]></option>";
echo "</select>";
}*/
mysql_close($con);
?>
any help is apreciated thanks in advance