Ok....below is the code:
<?php
$db = mysql_connect("localhost","admin","3under");
mysql_select_db("nnig") or die ("Cannot connect to database");
if(isset($_POST['city']):
$city=$_POST['city'];
$r=mysql_query("SELECT * FROM meetings WHERE city='$city' ORDER BY time DESC") or die(mysql_error());
echo "<table width=500 border=1>" .
"<tr><td>Time</td><td>Meeting Name</td><td>City</td></tr>";
// print out the meeting info
while($junk=mysql_fetch_array($r))
{
?>
<tr>
<td><?=$junk['time']?></td>
<td><?=$junk['meeting_name']?></td>
<td><?=$junk['city']?></td>
</tr>
<?
}
echo "</table>";
else:
// change the values to whatever they are on your page
$r=mysql_query("SELECT city FROM meetings ORDER BY city ASC") or die(mysql_error());
$cities=array();
// grab all city names and put them into an array
while($arr=mysql_fetch_array($r))
$cities[]=$arr['city'];
// form data, start select and print cities
echo "<form action=\"".$GLOBALS['PHP_SELF']."\" method=post>";
echo "<select name=\"city\">";
// make it so its only unique cities in the array
foreach(array_unique($cities) as $v)
echo "<option value=\"$v\">$v\n";
echo "</select>";
echo " <input type=submit value=\"Get Meetings\"></form>";
endif;
?>
<ERROR>
Notice: Undefined variable: PHP_SELF in c:\program files\apache group\apache\htdocs\nnig\newform.php on line 32.
What am I doing wrong?!?!?!!
Thanks,
Dave Mosher