i need to retrieve information about customer order when the user submit their name
this the code for first page

<?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 4</title>
 </head>
<body>
 <?php
 $conn = odbc_connect("warehouse","IWSDStudent","assign2");
 $sql = "SELECT lastName FROM customer ";
 $rs = odbc_exec($conn,$sql);
   ?>
    <form id="customerform" action="task10.php" method="get">
   <select name='class' size='1' >
   <?php
   while (odbc_fetch_array($rs))
   {
   $cusID = odbc_result($rs,"customerID");
   $lName = odbc_result($rs, "lastName");
   ?>
   <option value='<?php echo $cusID; ?>'><?php echo $lName; ?></option> 
   <?php
   }
    
   odbc_close($conn);
   ?>
    </select>
   <p><input type="submit" value="Submit">
   <input type="reset" value="Reset"></p>
   </form>
   </body>
   </html>

then goes to this page to get information but it doesnt work

<?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>Task 10 PHP</title>
   </head>
    
   <body>
   <?php 
   $cusID = $_GET["custID"];
   $conn = odbc_connect("warehouse","IWSDStudent","assign2");
   $sql= "SELECT orderNumber, orderDate,shipped FROM orders WHERE customerID= '$cusID'";
   $rs = odbc_exec($conn,$sql);
   ?>
   <table border="1" summary="product Details">
   <tr>
   <th>Order NO</th>
   <th>Order date </th>
   <th>Shipped</th>
   </tr> 
   <?php 
   if (odbc_num_rows($rs)>0) { // Got some data?
   while (odbc_fetch_row($rs))
   {
   $orderNo = odbc_result($rs,"orderNumber");
   $orderdate = odbc_result($rs, "orderDate");
   $shipped = odbc_result($rs,"shipped");
   echo "<tr><td>$orderNo</td>";
   echo "<td> $orderdate</td>";
   echo "<td> $shipped</td></tr>";
    
   }
    
         }
    
         else {
    
       // Display an error message if no data was retrieved or some other error condition was encountered.
    
       print "<p>There's no values for the customer id please try again: $cusID.</p>";
       print "<p><a href=\"task10.htm\">Return to try another number.</a></p>";
    
     }
     odbc_close($conn);
   ?>
     </body>
   </html>
commented: Use [code] tags. Mention your problem in detail. -2
Member Avatar
diafol

You're trying to retrieve $_GET variable when it should be $_POST. You also need to give the select tag the id = "custID", or no $_POST can exist.

Hope I got the right end of the stick.

i doesnt work but imthinking using query string but i dont know how
thanks