{
The page in question can be viewed at http://80.193.62.89/AmmoBox/Admin/ViewOrders2.php
}
i have a script that outputs all of my orders and then you press and order name and it displays the infomation on the order, i have done that and made a table but the only problem is that table now outputs on the "view orders" bit. Here is the code
mysql_select_db($database_AmmoBox, $AmmoBox);
$query_ViewOrders = "SELECT id, username FROM orders WHERE orders.Processed = '0'";
$ViewOrders = mysql_query($query_ViewOrders, $AmmoBox) or die(mysql_error());
$row_ViewOrders = mysql_fetch_assoc($ViewOrders);
$totalRows_ViewOrders = mysql_num_rows($ViewOrders);
// if no id is specified, list the new orders
if(!isset($_GET['id'])) {
$self = $_SERVER['PHP_SELF'];
$query ="SELECT id, username FROM orders WHERE Processed = '0' ORDER BY id";
$result = mysql_query($query) or die('Error : ' . mysql_error());
// create the new order list
$content = '<ol>';
while($row = mysql_fetch_array($result, MYSQL_NUM))
{
list($id, $Username) = $row;
$content .="<li><a href=\"$self?id=$id\">$Username</a></li>\r\n";
}
$content .= '</ol>';
$Username = 'New Orders';
}
else
{
// get the order info from database
$query ="SELECT * FROM orders WHERE id=".$_GET['id'];
$result = mysql_query($query) or die('Error : ' . mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$Username = $row['Username'];
$content = $row['content'];
$Payment = $row['Payment'];
$Branding = $row['Branding'];
$Date = $row['Date'];
$Game = $row['Game'];
$Slots = $row['Slots'];
$Cost =
$row['Cost'];
}
?>
This first block of code gets all of the data from the database and the var $content displays the content to display wether it be the order list, or the selected order infomaition
<html>
<head>
<title>
<?php echo $Username;?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
h1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
color: #006699;
font-weight: bold;
}
.main {
padding: 10px;
border: 1px solid #006699;
position: relative;
width: 580px;
margin-top: 20px;
margin-bottom: 20px;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; font-size: 14px; }
-->
</style>
</head>
<body>
<table width="600" border="0" align="center" cellpadding="10" cellspacing="1" bgcolor="#336699">
<tr>
<td bgcolor="#FFFFFF">
<h1 align="center"><?php echo $Username;?></h1>
<?php
echo $content;
echo "<table width = \"600\" border = \"0\" cellpadding = \"2\" cellspacing\"1\">
<tr>
<td><span class=\"style3\">ID</span></td><td><span class=\"style3\">Date Orderd</span></td><td><span class=\"style3\">Game</span></td><td><span class=\"style3\">Slots</span></td><td><span class=\"style3\">Branding</span></td><td><span class=\"style3\">State</span></td><td><span class=\"style3\">Cost</span></td>
</tr>
<tr>
<td>$ID</td><td>$Date</td><td>$Game</td><td>$Slots</td><td>$Branding</td><td>$State</td><td>$Cost</td>
</tr>
</table>";
// when displaying an order show a link
// to see the order list
if(isset($_GET['id']))
{
?>
<p> </p>
<p align="center"><a href="<?php echo $_SERVER['PHP_SELF']; ?>">New Order List</a></p>
<?php
}
?>
</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($ViewOrders);
?>
This next block which is directly under the first is the hTML output for the orders. you can see my echo $content which displays the list or order info and the table directly bellow it. Now the details i nteh table correctly work for each order but when in the order list the table (but no dynamic data) is still there.
What i need to do is to display the order list and when a name is pressed display the details in a table, but i cant see how to seperate them. I was thinking of when and order name is pressed to display the info on it then the $content var is un-set and replaced witht he table to display but i am quite confused about how to go about it. Anyone can assit on a way to do this.
Thanks
Chris
(sorry for long post)