0

hi ive been working from a few questions etc at college and im really stuck on this particularly one. i am given this code :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Prac3 Task 8</title>
</head>
<body>
 <h1>Task 8</h1>
 <!-- for the purpose of this and subseqent tasks DO NOT modify the method of this form -->

 <form id="customerform" action="task8.php" method="get">
  <p>please fill in the following form</p>
<p>Customer ID:  <input type="text" name="custID"/><br/>
<p><input type="submit"  value="Submit">
  <input type="reset" value="Reset"></p>
 </form>
</body>
</html>
<body><body>

the question ask which i must do is make a php page in which a person inputs the known ID and i give them the correct information by the input.

example for page 1 i input 123456
then i submit. what should come back is the ordernumber, orderdate and shipped data relating to customer id 123456.

this is my code thus far

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Prac 3 Task 3</title>
</head>
<body>


<?php $conn = mysql_connect("localhost", "twastudent", "prac3");
mysql_select_db("warehouse", $conn)
or die ('Database not found ' . mysql_error() );
$cust = $_GET["custID"];
$sql = "select * from orders";
$sql = $sql . "where customerID='$cust'";
$rs = mysql_query($sql, $conn)
or die ('Database not found ' . mysql_error() );
?>

<?php if (mysql_num_rows($rs)>0){ ?>
<table width="700" border="1" cellpadding="10">
<tr><td>Phone Number</td><td>Email</td><td>Suburb</td></tr>
<?php while ($row = mysql_fetch_array($rs)) { ?>
<tr>
<td><?php echo $row["orderNumber"]?></td>
<td><?php echo $row["orderDate"]?></td>
<td><?php echo $row["shipped"]?></td></tr>
<?php } ?></table>
<?php }
else {?> <p>No customer with id <?php echo $name ?>
in autoservice database.</p>
<?php } ?> </body></html>

when i apply it to the test server it claims i have syntax problems but i doubt that is all. any help would be appreciated greatly. thanks

Edited by BryantFury: spelling

1
Contributor
1
Reply
6
Views
6 Years
Discussion Span
Last Post by BryantFury
0

nvm self fixed. it turns out my sql select etc wasnt implemented properly

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.