The site I'm working on is here. Http://dky.sytes.net/golesnew/cat/showtable.php and its set up like so. there's a dropdown which displays the available tables in a mysql database, and when you select a table, it displays all rows in that table along with an edit, and delete link. I want the dropdown to dissapear when you click either the edit or the delete link. but I want it to stay when you select from the dropdown. Anyone know how I can keep it? I used to have a if (!$_GET) but that didnt work, because it would disappear when I selected a table from the dropdown. Any ideas? Here's my code.
<html>
<head>
<title>Display the Categories for Item Editing/Deleting</title>
<LINK HREF="catalogwhite.css" REL="STYLESHEET">
</head>
<body>
<?php
require('connect.php');
database_connect();
display_tables();
echo "<form action=\"$_SERVER['PHP_SELF']?mode=changedropdown\" method=\"post\" NAME=\"show_tables\">";
echo "<br />";
echo "<table align=\"center\">";
echo "<tr>";
echo "<td width=\"100%\" valign=\"top\" align=\"center\">";
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 "</td></tr></table></form>";
######################################## DROPDOWN SELECTED SECTION ########################################
if('changedropdown' == $_GET['mode']) {
#if (isset($_POST['Select'])) {
$table = $_POST['view_category'];
if ('ViewTheContentsofaTable' == $table) {
?>
<br /><br /><br /><br />
<font id="title">Please Select a Category</font>
<?php
} else {
$query = "SELECT * FROM $table";
$result = mysql_query($query) or die(mysql_error().'<br />');
?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" name="tables_themselves">
<p align="center">
<br /><br />
<font id="title"><?php echo $table;?></font>
<table width="650" CELLSPACING="15">
<tr><td colspan="7"> </td></tr>
<tr id="headers">
<td align="center">Number</td>
<td align="center">Picture</td>
<td align="center">Thumbnail</td>
<td align="left">Item</td>
<td align="center">Description</td>
<td align="right">Price</td>
<td align="center"> </td>
</tr>
<tr>
<td colspan="7"><hr /></td>
</tr>
<?php
while ($row = mysql_fetch_assoc($result)) {
$edit = '<a href="?mode=edit&table=' . $table . '&Product_Number=' . $row['Product_Number'] . '">
Edit</a>';
$delete = '<a href="?mode=delete&table=' . $table . '&Product_Number=' . $row['Product_Number'] . '">
Delete</a>';
echo "<tr><td>{$row['Product_Number']}</td><td>{$row['Picture']}</td><td>{$row['Thumbnail']}</td>
<td>{$row['Item_Name']}</td><td>{$row['Description']}</td><td align=\"right\">\${$row['Price']}</td>
<td>$edit $delete</td></tr><tr><td colspan=\"7\"><hr /></td></tr>\n";
}
}}
echo "</table></form>\n";
######################################## EDIT SECTION ########################################
if('edit' == $_GET['mode']) {
$table=$_GET['table'];
$editquery = "SELECT Item_Name, Picture, Price, Description FROM $table WHERE
Product_Number='{$_GET['Product_Number']}'";
$editresult = mysql_query($editquery) or die(mysql_error().'<br />');
if (!$_POST)
{
while ($editrow = mysql_fetch_array($editresult)) {
ECHO "<div class='outer'><div class='inner'><P ALIGN=CENTER>
<FORM ENCTYPE='multipart/form-data' ACTION='$_SERVER['PHP_SELF']' METHOD='POST' NAME='input_item'>
<input type=hidden name='max_file_size' value='2000000'>
<br><TABLE WIDTH='600' CELLPADDING='0' CELLSPACING='0' BORDER='0'>
<TR><TD VALIGN=top><p align='center'>
<TABLE WIDTH='50%' bordercolor='black' CELLPADDING='0' CELLSPACING='0' BORDER='0'><TR>
<TD style='border-bottom-style: solid; border-bottom-width:1'
style='border-right-style: solid; border-right-width: 1'
style='border-top-style: solid; border-top-width:1'
style='border-left-style: solid; border-left-width: 1'
WIDTH='250' BGCOLOR='#CCD6CD' VALIGN=top id='headers'> Name of the Item:</TD></TR>
<TR>
<TD WIDTH='250' VALIGN=TOP>
<input type='text' value=$editrow[Item_Name] name='item' size=40>
</TD></TR>
</TABLE>
</TD><TD VALIGN=top><p align='center'>
<TABLE WIDTH='50%' bordercolor='black' CELLPADDING='0' CELLSPACING='0' BORDER='0'><TR>
<TD style='border-bottom-style: solid; border-bottom-width:1'
style='border-right-style: solid; border-right-width: 1'
style='border-top-style: solid; border-top-width:1'
style='border-left-style: solid; border-left-width: 1'
WIDTH='250' BGCOLOR='#CCD6CD' VALIGN=top id='headers'> Upload a Thumbnail From:</TD></TR>
<TR>
<TD WIDTH='250' VALIGN=TOP>
<input type='File' name='tn_upload' size=26 value=$editrow[Thumbnail] maxlength='255'>
<br></TD></TR>
</TABLE>
</TD></TR><TR><TD VALIGN=top><p align='center'>
<TABLE WIDTH='50%' bordercolor='black' CELLPADDING='0' CELLSPACING='0' BORDER='0'><TR>
<TD style='border-bottom-style: solid; border-bottom-width:1'
style='border-right-style: solid; border-right-width: 1'
style='border-top-style: solid; border-top-width:1'
style='border-left-style: solid; border-left-width: 1'
WIDTH='250' BGCOLOR='#CCD6CD' VALIGN=top id='headers'> Price of the Item:</TD></TR>
<TR>
<TD WIDTH='250' VALIGN=TOP><p align='center'>
<input type='text' name='price' value=$editrow[Price] size=40>
<BR></TD></TR>
</TABLE>
</TD><TD VALIGN=top><p align='center'>
<TABLE WIDTH='50%' bordercolor='black' CELLPADDING='0' CELLSPACING='0' BORDER='0'><TR>
<TD style='border-bottom-style: solid; border-bottom-width:1'
style='border-right-style: solid; border-right-width: 1'
style='border-top-style: solid; border-top-width:1'
style='border-left-style: solid; border-left-width: 1'
WIDTH='250' BGCOLOR='#CCD6CD' VALIGN=top id='headers'> Upload a Picture From:</TD></TR>
<TR>
<TD WIDTH='250' VALIGN=TOP>
<input type='File' name='pic_upload' size=26 value=$editrow[Picture] maxlength='255'>
</TD></TR>
</TABLE>
</TD></TR><TR><TD colspan='2'><p align='center'>
<TABLE WIDTH='250' bordercolor='black' CELLPADDING='0' CELLSPACING='0' BORDER='0'><TR>
<TD style='border-bottom-style: solid; border-bottom-width:1'
style='border-right-style: solid; border-right-width: 1'
style='border-top-style: solid; border-top-width:1'
style='border-left-style: solid; border-left-width: 1'
WIDTH='250' BGCOLOR='#CCD6CD' VALIGN=top id='headers'> Description of the Item:</TD></TR>
<TR>
<TD WIDTH='250' VALIGN=TOP>
<textarea name='description' cols='50' rows='10' wrap>$editrow[Description]</textarea>
<BR></TD></TR>
</TABLE>
</TD></TR></TABLE>
<br><input type='submit' name='Update' value='Update'>
</form></div></div></body></html>";
}}
if ($_POST["Update"])
{
$itemupdatequery = "UPDATE `$table` SET Picture='{$_POST['pic_upload']}', Item_Name='{$_POST['item']}',
Description='{$_POST['description']}', Price='{$_POST['price']}', Thumbnail='{$_POST['tn_upload']}' WHERE
Product_Number='{$_GET['Product_Number']}'";
$itemupdateresult = mysql_query($itemupdatequery);
if (!$itemupdateresult)
{
$mcrmessage = mysql_error();
echo "$mcrmessage<br>";
die();
}
else
{
echo "<div class='returnouter'><div class='returninner'><p align='center'><font id='headers'><br>
You have successfully edited the item named \"$item\"<br><br><a href='showtable.php'>
Click the link to return to the categoryviewing page.</a></font></div></div></body></html>";
exit();
}
}
}
######################################## DELETE SECTION ########################################
if('delete' == $_GET['mode']) {
$table=$_GET['table'];
echo "table: $table<br>";
$deletequery = "DELETE FROM `$table` WHERE Product_Number='{$_GET['Product_Number']}'";
$deleteresult = mysql_query($deletequery) or die(mysql_error().'<br />');
echo "<p align='center'><font id='headers'><br>good job, <a href='showtable.php'>";
echo "click here to go back</a></font></body></html>";
}
database_disconnect();
?>
</body>
</html>