Hi I'm very new into this website and to PHP.
I want to make a drop down to display from my database. when i wrote the option value, a drop down is displaying in my html page however all the data comes together in one drop down. I want to make them in three separate that's Car_ID, Registration_number and make drop down and a submit button.
<html>
<h1> Online car sale garadge. </h1>
<h2>This website is designed to search and buy cars online </h2>
<body bgcolor="33EE77">
<img src="pink.jpg" width="340" height="250" />
</style>
</head>
<body>
<?php
$dbhost = '127.0.0.1';
$dbuser = 'root';
$dbpass = 'root';
$dbname = 'car sale project'; //Replace with your database name
$dbconn = mysql_connect($dbhost, $dbuser, $dbpass);
if (!$dbconn)
{die('Error connecting to the DB!');}
if ($dbconn)
{echo('<p>Please select the car you want to buy.</p>');}
if (!mysql_select_db($dbname))
{die( '<p>Unable to locate the main database.</p>');}
if (mysql_select_db($dbname))
{echo('<p>You are now connected to our database.</p>');}
$query = "SELECT * from cars";
$result = mysql_query($query);
?>
<select name="cars">
<?php
while ($row=mysql_fetch_array($result))
{
?>
<tr>
<tb>
<option value="" selected>Select </option>
<option value="Cars_ID "><?php echo($row['Cars_ID']);?></option></br>
<option value="Registration_number "><?php echo($row['Registration_number']);?></option></br>
<option value=" "><?php echo($row['Make']);?></option></br>
</tb>
</tr>
<?php
}
?>
</select>
</td>
</tr>
</table>
</div>
</body>
</html>
Thank you for any suggestion! Abe