Jump to content

ebailey

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ebailey's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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%'>&nbsp;</td>"; echo "<td width='19%'>&nbsp;</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>&nbsp;</p>"; echo "<p align='center'>"; echo "<label>"; echo "<input name='Submit' type='submit'/>"; echo "</label>"; echo "</p>"; echo "</form>"; ?> </body> </html>
  2. Hi, I am sure this is easy but I am totally confused and need help. What I am trying to do is to generate a form from a database query and then recieve user import that is then passed to a summary page where the user decides if they want to place the order. I made the form and it is generated from the database with no issues. Here is the code // 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='order_amount' 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); The query has two records and the code generates two tables but the text input boxes have the same name so I have no idea how to pass that user input to the summary page since using a POST will only pass info from one box to the summary page. Any idea how to pass the user inpt to the summary page? Is there some way to increment the test box name to make it unque? Thanks! Ed
×
×
  • 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.