This makes perfect sense now, onchange=\"this.form.submit();\" points to the action in the form, I think I figured it out. and if I want, I can put it like so mypage.php?mode=change in the action, and then use a php if statement to run the query, like so.
if('change' == $_GET['mode'])
{
}
That's awesome!!! Thanks a lot everyone. One problem I have though, my dropdown disappears when selected. here's the page I'm working on. http://dky.sytes.net/golesnew/cat/pickitem.php and here's the code, in case anyone wants to help me problem solve this. Thanks in advance.
<html><head><title>Pick an Item Page</title><LINK HREF="catalogwhite.css" REL="STYLESHEET"></head><body>
<?
require("connect.php" );
database_connect();
display_tables();
if (!$_GET)
{
echo "<form action=\"$_SERVER['PHP_SELF']?mode=change\" method=\"post\" NAME=\"show_tables\">";
echo "<br />";
echo "<table align=\"center\">";
echo "<tr>";
echo "<td width=\"100%\" valign=\"top\" align=\"center\">";
# must add this in the select below onChange=\"location.href="?mode=change&table=" . $table . ''\"
echo "<select name=\"view_category\" onchange=\"this.form.submit();\">";
echo "<option value=\"ViewTheContentsofaTable\"> ";
echo " View a Category ";
echo " ";
echo "</option>;";
while($row= mysql_fetch_array($result)) {
echo "\t\t\t\t<option>{$row[0]}</option>\n";
}
echo "</select>";
#echo " <input type=\"submit\" name=\"Select\" value=\"Select\" />";
echo "</td></tr></table>";
}
#if ($_POST["Select"]) {
#$table = $_POST["view_category"];
if('change' == $_GET['mode']) {
$table = $_POST["view_category"];
# $table=$_GET['table'];
if ($table == "ViewTheContentsofaTable" )
{
echo "<br><br><br><br><font id='title'>Please Select a Category</font>";
}
else
{
$query = "SELECT * FROM $table";
$result = mysql_query($query);
if (!$result)
{
$mcrmessage = mysql_error();
echo "$mcrmessage<br>";
die();
}
ECHO "<TABLE BORDERCOLOR='#003300' BORDER='0' CELLSPACING='0' CELLPADDING='10'>";
echo "<tr><td colspan='2' STYLE='border-bottom-style: solid; border-bottom-width:1'><center>
<font id='title'>$table</font></td></tr>";
while ($row = mysql_fetch_array($result))
{
extract($row);
echo "<tr onclick=\"java script:top.showitem.location.href('showitem.php?mode=view&
table=".$table."&main_id=".$row["Product_Number"]."');\" STYLE=\"Cursor:Hand;\"
ONMOUSEOVER=\"this.style.backgroundColor='#E2EEE2';\"
ONMOUSEOUT=\"this.style.backgroundColor='#FFFFFF';\">
<td STYLE='border-bottom-style: solid; border-bottom-width:1'>$Thumbnail</td>
<td STYLE='border-bottom-style: solid; border-bottom-width:1'>$Item_Name</td></tr>\n";
}
echo "</table>\n";
}
}
database_disconnect();
?>
</form></body></html>