The column names which are being taken from the database are all being added as ONE single option in the drop down menu. Where as, I want them to be separate options in the drop down menu. I don't know where am I going wrong. Please help!
The code is as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Cast your vote</title>
</head>
<body>
<center>
<font size=+8>WELCOME TO THE POLL</font>
<hr>
<br>
<br>
<br>
<br>
<center>
<form name="myform" action="http://localhost/project/Votingmodule/kankipadu.php" method="GET">
<h2>
Select one of the following parties :</h2>
<br>
<center>
<select name="options">
<option>B.J.P</option>
<option>Congress(I)</option>
<option>C.P.I(M)</option>
<option>
<?php
//initilaize the mysql user name and password
//Database Config
$dbHost='localhost'; //Database server
$dbName='db'; // Name of the database
$dbUser='root'; // Database username
$dbPass=''; // Database password
$source = mysql_connect($dbHost, $dbUser, $dbPass);
if (!$source) {
die('Not connected : ' . mysql_error());
}
$db_selected = mysql_select_db('db', $source);
if (!$db_selected) {
die ('Can\'t use $DB : ' . mysql_error());
}
$query1="select * from poll_status";
$result=mysql_query($query1) or die(mysql_error());
$numfields=mysql_num_fields($result);
$i=0;
for($i=6;$i < $numfields; $i++)
{
echo mysql_field_name($result,$i) . "<br>";
}
?>
</option>
</select>
<br><br>
<br>
<br>
<br>
<center>
<input type="submit" name="button1" value="Submit">
</center>
</form>