as requested - thanks! <!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> </head> <body> <?php $qid = intval($_GET['quote_num']); // set database server access variables: // open connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // create query $query = "SELECT DISTINCT quotes.name, product_bundles.name, quotes.purchase_order_num, quotes.quote_num, product_bundles.description, quotes.total, products.name, users.first_name, users.last_name, products.description, accounts.name, contacts.first_name, contacts.last_name, products.discount_price, contacts.portal_name, product_bundles.total, product_bundles.id FROM quotes_accounts INNER JOIN quotes ON (quotes_accounts.quote_id = quotes.id) INNER JOIN accounts ON (quotes_accounts.account_id = accounts.id) INNER JOIN quotes_contacts ON (quotes.id = quotes_contacts.quote_id) INNER JOIN contacts ON (quotes_contacts.contact_id = contacts.id) INNER JOIN product_bundle_quote ON (quotes.id = product_bundle_quote.quote_id) INNER JOIN users ON (quotes.created_by = users.id) INNER JOIN product_bundles ON (product_bundle_quote.bundle_id = product_bundles.id) INNER JOIN product_bundle_product ON (product_bundles.id = product_bundle_product.bundle_id) INNER JOIN products ON (product_bundle_product.product_id = products.id) WHERE (contacts.portal_name = 'Jane') AND (`quotes`.`quote_num` = '$qid')"; // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); $rows = mysql_fetch_row($result); echo "<form action='summary.php' method='post'>"; echo "<p align='center'><strong>Order form for Quote $rows[3] - $rows[0] </strong></p>"; echo "<table width='80%' border='1' align='center' bgcolor='#FFFFFF'>"; echo "<tr align='left' valign='middle'>"; echo "<td><strong>Customer</strong></td>"; echo "<td>$rows[10]</td>"; echo "<td><strong>PO Number </strong></td>"; echo "<td>"; echo "<input name='po_num' type='text' value='000' size='6' maxlength='6' /></td>"; echo "</tr>"; echo "<tr align='left' valign='middle'>"; echo "<td><strong>Customer Contact</strong></td>"; echo "<td>$rows[11] $rows[12]</td>"; echo "<td><strong>Sales Contact</strong></td>"; echo "<td>$rows[7] $rows[8]</td>"; echo "</tr>"; echo "</table>"; echo "<p align='center'><strong>Quoted Items</strong></p>"; echo "<table width='80%' border='0' align='center' bgcolor='#FFFFFF'>"; echo "<tr>"; echo "<td width='23%'><strong>Quanity</strong></td>"; echo "<td width='19%'><strong>Product</strong></td>"; echo "<td width='26%'><strong>Unit Price</strong></td>"; echo "<td width='32%'><strong>Order Items</strong></td>"; echo "</tr>"; echo "</table>"; // execute query $results = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); // see if any rows were returned if (mysql_num_rows($results) > 0) { // yes // print them one after another while($row = mysql_fetch_row($results)) { echo "<table width='80%' border='1' align='center' bgcolor='#FFFFFF'>"; echo "<tr>"; echo "<td width='23%' colspan='2'></td>"; echo "<td width='19%'>$row[6]</td>"; echo "<td width='26%'>$row[13]</td>"; echo "<td width='32%'><input name='order1' type='text' value='0' size='6' maxlength='6'></td>"; echo "</tr>"; echo "<tr>"; echo "<td width='23%'>Product Description</td>"; echo "<td colspan='4'>$row[9]</td>"; echo "</tr>"; } echo "</table>"; } else { // no // print status message echo "No rows found!"; } // free result set memory mysql_free_result($results); // close connection mysql_close($connection); echo "<table width='80%' border='0' align='center'>"; echo "<tr>"; echo "<td width='23%'> </td>"; echo "<td width='19%'> </td>"; echo "<td width='26%' align='center' valign='middle'><strong>Total</strong></td>"; echo "<td width='32%'><input name='total' type='text' value='0.00' size='6' maxlength='6'/></td>"; echo "</tr>"; echo "</table>"; echo "<p> </p>"; echo "<p align='center'>"; echo "<label>"; echo "<input name='Submit' type='submit'/>"; echo "</label>"; echo "</p>"; echo "</form>"; ?> </body> </html>