Hello, I just learned how to make a drop down menu using MySQL but for some reason now it wont pull information from the table
here is the link:
http://pennyspder.sousaink.com/geo.php
Under the drop down a table is suppose to show up to give you the geocache table when I had the drop down setup as html it worked fine which leads me to believe something is conflicting in my code. I need an extra pair of eyes to look at it, cause I just cant catch what Im missing.. Please help
<?php
//include files to configure db and open it
include 'config.php';
include 'opendb.php';
//pull name for drop down
$query = "SELECT name FROM geocache";
$result = mysql_query($query);
$options = "";
// find the selected geo name
$result2 = mysql_query("SELECT * FROM geocache WHERE name = '" . $_POST['name'] . "'");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Welcome to Penny and Spder's Site</title>
<link rel="stylesheet" type="text/css" href="PennySpder.css" />
</head>
<body>
<table id="maintable" cellpadding="0" cellspacing="0">
<tr>
<td><a href="index.php"><img src="images/title_2.jpg" border="0" alt="Penny & Spder" /></a></td>
<td><img src="images/title_1.jpg" alt="Taughannock Falls, Ithaca N.Y." /></td>
</tr>
<tr>
<td id="navbar" colspan="2"><?php include("navigation.html"); ?></td>
</tr>
<tr>
<td colspan="2"><table cellpadding="0" cellspacing="0">
<tr>
<td id="welcomeText"><p> </p>
<p>All coordinates are from <a href="#" onclick="MM_openBrWindow('http://www.geocaching.com/','','')">Geocaching.com</a></p>
<b><u>Use the drop down menu to view completed geo-caches:</u></b><br /><br />
<?php
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$options .="<option value={$row['name']}>".$row['name'].'</option>';
}
?>
<form method="post" action="geo.php">
<select name=id>
<?php print "$options"; ?>
</select>
<input type="submit" value="Submit" />
</form>
<?php
//takes the gathered information and format it
while ($row = mysql_fetch_assoc($result2)) {
print '<table id=geotable>
<tr>
<td class=geotableheader>Name:</td>
<td class=geotableheader>Parking:</td>
<td class=geotableheader>Geo-Cache:</td>
</tr>
<tr>
<td>' . $row['name'] . '</td>
<td>' . $row['park'] . '</td>
<td>' . $row['geocache'] . '</td>
</tr>
</table>';
}
?>
The rest is just html in the page... Thanks for the help
Antoni