Public feed
#724329
<?php
//lerie taylor - mr.lerie@gmail.com - f74640
//form.php
function getHttpVars() {
echo "<table border=1 align=center cellpadding=4 cellspacing=0>
<th colspan=5 style='padding:8px;' bgcolor=cfcfcf>Thanks For Ordering From Us!</th><tr>
<td><b>Qty</b></td>
<td><b>Item #</b></td>
<td><b>Description</b></td>
<td><b>Unit Price</b></td>
<td><b>Ext. Price</b></td></tr>";
for($i=1;$i<=5;$i++) {
$curQty = "qty".$i;
$curItemNum = "itemnum".$i;
$curDesc = "desc".$i;
$unitPrice = "price".$i;
$weight = "nums".$i;
if($_POST[$curQty] > 0) {
//assign the form's post information to variables
$qty = clean($_POST[$curQty]);
$itemNum = clean($_POST[$curItemNum]);
$desc = clean($_POST[$curDesc]);
$unitPrice = clean($_POST[$unitPrice]);
$weight = clean($_POST[$weight])*$qty;
$exPrice = $unitPrice*$qty;
$prodTotal = $prodTotal+$exPrice;
$totalWeight = $totalWeight+$weight;
//echo "weight: $weight<br>totalWeight: $totalWeight<hR>";
$shipChge = 1.25*$totalWeight;
$salTax = $prodTotal*.0775;
$invTotal = $prodTotal+$shipChge+$salTax;
echo "<tr>
<td>$qty</td>
<td>$itemNum</td>
<td>$desc</td>
<td align=right bgcolor=yellow>$".number_format($unitPrice,2)."</td>
<td align=right bgcolor=ffcc00>$".number_format($exPrice,2)."</td>
</tr>";
}//endif
}//endfor
echo "<tr align=right><td colspan=4><b>Product Total</b></td><td bgcolor=ffcc00>$".number_format($prodTotal,2)."</td></tr>
<tr align=right><td colspan=4><b>Shipping Charge</b></td><td bgcolor=ffcc00>$".number_format($shipChge,2)."</td></tr>
<tr align=right><td colspan=4><b>Sales Tax</b></td><td bgcolor=ffcc00>$".number_format($salTax,2)."</td></tr>
<tr align=right><td colspan=4><b>Invoice Total</b></td><td bgcolor=ffcc00>$".number_format($invTotal,2)."</td></tr>
</table>";
}//endfunction
function clean($string) {
$string = stripslashes($string);
$string = htmlentities($string);
return $string;
}
function loadQty() {
echo "<option> </option>";
for($i=1;$i<=10;$i++) {
echo "<option>$i</option>";
}
}
$action = clean($_GET[action]);
if(isset($action) && $action == "submit") {
getHttpVars();
echo "<hr size=1 width=400 noshade><center>If there was an error, <a href=form.php>go back</a> if not, <a href=#>proceed to checkout</a></center>";
} else {
?>
<form method=post action=?action=submit>
<table border=0 width=520>
<tr bgcolor=cfcfcf align=center>
<td><b>Quantity</b></td>
<td><b>Item #</b></td>
<td><b>Description</b></td>
<td><b>Price</b></td>
<td><b>Weight</b></td>
</tr>
<tr>
<td><select name=qty1><?php loadQty(); ?></select></td>
<td><input type=hidden name=itemnum1 value=1111>1111</td>
<td><input type=hidden name=desc1 value=Gizmo>Gizmo</td>
<td align=right><input type=hidden name=price1 value="4.95">$4.95</td>
<td align=right><input type=hidden name=nums1 value=5>5</td>
</tr>
<tr>
<td><select name=qty2><?php loadQty(); ?></select></td>
<td><input type=hidden name=itemnum2 value=2222>2222</td>
<td><input type=hidden name=desc2 value=Widget>Widget</td>
<td align=right><input type=hidden name=price2 value="6.95">$6.95</td>
<td align=right><input type=hidden name=nums2 value=3>3</td>
</tr>
<tr>
<td><select name=qty3><?php loadQty(); ?></select></td>
<td><input type=hidden name=itemnum3 value=3333>3333</td>
<td><input type=hidden name=desc3 value=Wingding>Wingding</td>
<td align=right><input type=hidden name=price3 value="13.95">$13.95</td>
<td align=right><input type=hidden name=nums3 value=12>12</td>
</tr>
<tr>
<td><select name=qty4><?php loadQty(); ?></select></td>
<td><input type=hidden name=itemnum4 value=4444>2222</td>
<td><input type=hidden name=desc4 value=Gadget>Gadget</td>
<td align=right><input type=hidden name=price4 value=".69">$.69</td>
<td align=right><input type=hidden name=nums4 value=25>25</td>
</tr>
<tr>
<td><select name=qty5><?php loadQty(); ?></select></td>
<td><input type=hidden name=itemnum5 value=5555>2222</td>
<td><input type=hidden name=desc5 value='Super Gizmo'>Super Gizmo</td>
<td align=right><input type=hidden name=price5 value="169.99">$169.99</td>
<td align=right><input type=hidden name=nums5 value=64>64</td>
</tr>
<tr>
<tD colspan=5 align=right><bR><input type=submit value=submit> <input type=reset value=reset></td>
</tR>
</table>
</form>
<?php } ?>