Jump to content

Trent

New Members
  • Posts

    4
  • Joined

  • Last visited

Trent's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you GURU the array did work. I did not want to give the value of each individual item just a total. I redid the form and process to this which appears to work fine. Again I am very new to PHP - How hard would this be to scale from 12-1200 line items for quotes? <html> <head> <title> </title> </head> <body> <h1>ACME Service Company</h1> <h2>Quote Form</h2> <form action="processquote3.php" method=post> <table border=0><tr><td bgcolor="CCCCCC">ITEM</td> <td bgcolor="CCCCCC">QUANTITY</td></tr> <tr> <td>Service 1</td><td align="center"><input type="text" name="s1qty" size=3 maxlength=3> </td></tr> <tr><td>Service 2</td><td align="center"><input type="text" name="s2qty" size=3 maxlength=3></td></tr> <tr><td>Service 3</td><td Align="center"><input type="text" name="s3qty" size=3 maxlength=3></td></tr> </table> <input type=submit value="Submit Quote"> </form> </body> </html> <HTML> <HEAD><TITLE>ACME Service Company - Quote Results</TITLE> </HEAD> <BODY> <H1>ACME Service Company</H1> <H2>Quote Results</H2> <?PHP $s1qty = $_POST['s1qty']; $s2qty = $_POST['s2qty']; $s3qty = $_POST['s3qty']; echo "<P>Quote Processed."; echo date("H:i, jS F"); echo "<br><br>"; echo "Service 1: ".$s1qty."<BR>"; echo "Service 2: ".$s2qty."<BR>"; echo "Service 3: ".$s3qty."<BR>"; $totalqty = 0; $totalamount = 0.00; define("SERVICE1PRICE", 10); define("SERVICE2PRICE", 7); define("SERVICE3PRICE", 2); $totalqty = $s1qty + $s2qty + $s3qty; $totalamount = $s1qty * SERVICE1PRICE + $s2qty * SERVICE2PRICE + $s3qty * SERVICE3PRICE; $totalamount = number_format($totalamount, 2); echo "<BR>\n"; echo "Items ordered: ".$totalqty."<br><br>\n"; echo "Subtotal: ".$totalamount."<BR><br>\n"; $taxrate = 0.10; // local sales tax is 10% here $totalamount = $totalamount * (1+$taxrate); $totalamount = number_format($totalamount, 2); echo "Total Quoted Including Tax: $".$totalamount."<BR>\n"; ?> </BODY> </HTML>
  2. OK thanks let me try to wrap my head around it.
  3. I apologize. I am trying to create a form that processes service quotes. The user inputs the total qty of each service into the form then submits quote. On the processquote.php it is to take the qtys and multiply them times the cost for each service, then add them to give the user a total quote price. My process displays the qty the user inputs but does not return (echo) the value of the quote (s1 + s2 + s3). Thank you.
  4. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Acme Service Company</title> </head> <body style="font-family: Arial"> <h1><br> Acme Service Company</h1> <p>Component Quote Form</p> <FORM ACTION="processquote.php" method=post> <table border=0> <tr> <td width=150>Item<br> </td> <td width=15>Quantity<br> </td> </tr> <tr> <td>Service 1</td> <td align="center"><input type="text" name="qtys1" size="3" maxlength="3"></td> </tr> <tr> <td>Service 2</td> <td align="center"><input type="text" name="qtys2" size="3" maxlength="3"></td> </tr> <tr> <td>Service 3</td> <td align="center"><input type="text" name="qtys3" size="3" maxlength="3"></td> </tr> <tr> <td colspan="2" align="center"><br> <input type="submit" value="Enter Quote"></td> </tr> </table> </form> </body> </html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Acme Service Company</title> </head> <body style="font-family: Arial"> <h1><br> Acme Service Company</h1> <p> </p> <?php $qtys1 = $_POST['qtys1']; $qtys2 = $_POST['qtys2']; $qtys3 = $_POST['qtys3']; $prices1 = 5.00; $prices2 = 3.00; $prices3 = 1.00; function values1($qtys1, $prices1) { $values1 = $qtys1 * $prices1; return $values1; echo $values1; } function values2($qtys2, $prices2) { $values2 = $qtys2 * $prices2; return $values2; } function values3($qtys3, $prices3) { $values3 = $qtys3 * $prices3; return $values3; } function totalquote($values1, $values2, $values3) { $totalquote = $values1 + $values2 + $values3; return $totalquote; } ?> <p>Thank you!</p> <p>Your Quote for:</p> <?php echo $qtys1.' service 1<br>'; echo $qtys2.' service 2<br>'; echo $qtys3.' service 3<br><br>'; echo $totalquote.' Quote'; ?> <p>was processed.</p> </body> </html>
×
×
  • 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.