I am trying to create a drop down menu that will display Project Names off all Projects present in the table Project in the database Testing... The drop down is created but it is not accessing the database and retrieving the required data... The code is as follows:
<html>
<head>
<title>Dynamic Drop Down List</title>
</head>
<form id="form1" name="form1" method="post" action="<?php echo $PHP_SELF; ?>">
Project List :
<select Project Name='NEW'>
<option value="">--- Select ---</option>
<?
$serverName = "Swagatha-PC";
$connectionInfo = array( "Database"=>"Testing");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn )
{
echo "Connection established.<br />";
}
else
{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
if (isset ($select)&&$select!="")
{
$select=$_POST ['NEW'];
}
?>
<?
$query=mysql_query("select ProjectName from dbo.Project");
$menu=" ";
while($row = sqlsrv_fetch_array($query))
{
$menu ="<option>" . $row["ProjectName"] . "</option>";
}
?>
</select>
<input type="submit" name="Next" value="Select" />
</form>
</body>
</html>
What Do i do to fix this??