I have php code to select records from a table in mysql. I have a dropdown box that isn't filling in with the records. Not sure what I am doing wrong. Thank you in advance for any help you can provide.
Here is my code...
<html>
<body>
<head>
<title>Search for a Pattern</title>
</head>
<body bgcolor="#ffffff">
<h2>Search for a Pattern</h2>
<form action="action" method="post">
<select name="option">
<?php
$user = "Admin";
$host = "LocalHost"
$password = ""
$dbName = "mypatterns"
mysql_connect($host, $user, $password) OR DIE( "Unable to connect to database");
mysql_select_db($dbName);
$sql = "SELECT PatternNo FROM patterns";
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
echo '<option value="' . $row['PatternNo'] . '">' . $row['PatternNo'] . '</option>';
}
?>
</select>
</form>
Here is my code...
<html>
<body>
<head>
<title>Search for a Pattern</title>
</head>
<body bgcolor="#ffffff">
<h2>Search for a Pattern</h2>
<form action="action" method="post">
<select name="option">
<?php
$user = "Admin";
$host = "LocalHost"
$password = ""
$dbName = "mypatterns"
mysql_connect($host, $user, $password) OR DIE( "Unable to connect to database");
mysql_select_db($dbName);
$sql = "SELECT PatternNo FROM patterns";
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
echo '<option value="' . $row['PatternNo'] . '">' . $row['PatternNo'] . '</option>';
}
?>
</select>
</form>