Public feed #725585

Untitled

public text v1 · immutable
Raw Edit
·published 2007-10-04 15:18 UTC
rendered paste body
<?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;
      $shipChge = $qty*$weight*1.25;
      $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

      $totalWeight = number_format($qty*$weight,2);
      //$shipChge = $totalWeight*1.25;

  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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>";
  for($i=1;$i<=10;$i++)  {
    echo "<option>$i</option>";
  }
}

?>