Jump to content

Recommended Posts

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.

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 = @mysql_query ($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><b>Order Name: </b></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</a></font></p>";
print "<p><font color=red>$client_name</a></font></p>";
print "<p><font color=red>$test_ordered</a></font></p>";
print "<p><font color=red>$salesperson</a></font></p>";
print "<p><font color=red>$order_date</a></font></p>";
print "<p><font color=red>$pulldown2</a></font></p>";


}
?>


</body>
</html>
Link to comment
https://forums.phpfreaks.com/topic/35303-help-with-some-database-and-fourm-code/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.