Below is what I have so far. My problem is I want select the clients name and number and view all of the infomation stored for that client in all the rows in the database. This must be in a table format with headers that I can name. Example clients_name would be Customers Name. Thanks for your help. PS the print statements on the bottom are there only to see if the data has been passed.
Mike
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
color: #3300FF;
font-weight: bold;
}
.style2 {
color: #0033FF;
font-weight: bold;
}
-->
</style>
</head>
<body>
<div align="center">
<h1 class="style1">Coin Database </h1>
<h2 class="style1">Data Entry </h2>
</div>
<p align="center" class="style2">Result List </p>
<?php
$usr = "888";
$pwd = "888";
$db = "888";
$host = "localhost";
// # connect to database
$cid = mysql_connect($host,$usr,$pwd);
mysql_select_db($db);
if (mysql_error()) { print "Database ERROR: " . mysql_error(); }
// Create the pull-down menu information.
$query1 = "SELECT order_number,client_name,test_ordered,salesperson,order_date FROM orders ORDER BY order_number ASC";
$result1 = @ ($query1);
$pulldown1 = '<option>Select One</option>';
while ($row = mysql_fetch_array ($result1, MYSQL_ASSOC)) {
$pulldown1 .= "<option value=\"{$row['order_number']}\">{$row['order_number']}) {$row['test_ordered']}</option>\n";
}
?>
<form name="orders" action="orderlookup.php" method="POST">
<table> <tr><td>Order Name: </td><td>
<select name="order_number">
<?php echo $pulldown1; ?> </select>
</td></tr></table>
<p><input type="submit" value="View Results"></p>
</th></tr></table>
</form>
<?php
// this is processed when the form is submitted
// back on to this page (POST METHOD)
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
# escape data and set variables
$order_number = addslashes($_POST["order_number"]);
$client_name = addslashes($_POST["client_name"]);
$test_ordered = addslashes($_POST["test_ordered"]);
$salesperson = addslashes($_POST["salesperson"]);
$order_date = addslashes($_POST["order_date"]);
print "<p><font color=red>$order_number[/url]</font></p>";
print "<p><font color=red>$client_name[/url]</font></p>";
print "<p><font color=red>$test_ordered[/url]</font></p>";
print "<p><font color=red>$salesperson[/url]</font></p>";
print "<p><font color=red>$order_date[/url]</font></p>";
print "<p><font color=red>$pulldown2[/url]</font></p>";
}
?>
</body>
</html>