- Joined
- Feb 19, 2010
- Messages
- 158
- Reaction score
- 174
Offline
I am doing an assignment where an order is placed and the data is transferred and displayed on a separate page. My order results page shows only the php code. Could someone please look over my code and let me know what you think is wrong. I have a feeling there are a few problems.
Thanks in advance.
<!--?php
echo "Order Processed.";
echo date('H:i, jS F Y');
$folkloreqty = $_POST['Folklore'];
echo $folkloreqty." Folklore"; //acknowledging quantities for paintings
echo "\n";
$greenfleurqty = $_POST['Green Fleur'];
echo $greenfleurqty." Green Fleur";
echo "\n";
$purplefleurqty = $_POST['Purple Fleur'];
echo $purplefleurqty." Purple Fleur";
echo "\n";
$goldfleurqty = $_POST['Gold Fleur'];
echo $goldfleurqty." Gold Fleur";
echo "\n";
$customqty = $_POST['Custom Add On'];
echo $customqty." Custom Add on";
echo "\n";
echo $shippingcost." S & H";
echo "\n";
$totalqty = 0; //setting variable type
$totalamt = 0.00;
define("FOLKLOREPRICE", 65); //setting constants for pricing
define("GREENFLEURPRICE", 40);
define("PURPLEFLEURPRICE", 40);
define("GOLDFLEURPRICE", 50);
define("CUSTOMADDPRICE", 75);
define("SHIPPINGCOST", 12.95);
$totalqty = $folkloreqty + greenfleurqty + purplefleurqty + goldfleurqty + customqty; //calc for quantity
$totalamt = $folkloreqty * FOLKLOREPRICE
+ greenfleurqty * GREENFLEURPRICE
+ purplefleurqty * PURPLEGLEURPRICE
+ goldfleurqty * GOLDFLEURPRICE
+ SHIPPINGCOST; //calculation for total
$totalamt = number_format($totalamount, 2); //setting 2 decimal places
echo "\n";
echo "Items Ordered: ".totalqty. "\n";
echo "Subtotal: ".totalamt. "\n";
$tax = .09; /*tax amount to be included in total*/
$totalamt = $totalamt * (1+$tax); //tax calculation to new total.
$totalamt = number_format($totalamt, 2); //setting format for total
if ($totalamt > "300")
{
echo "Shipping is Free!. Your total is: $" .$totalamt - 1;
}
else
echo "Total tax included: $" .$totalamt.;
echo "\n";
Thanks in advance.
<!--?php
echo "Order Processed.";
echo date('H:i, jS F Y');
$folkloreqty = $_POST['Folklore'];
echo $folkloreqty." Folklore"; //acknowledging quantities for paintings
echo "\n";
$greenfleurqty = $_POST['Green Fleur'];
echo $greenfleurqty." Green Fleur";
echo "\n";
$purplefleurqty = $_POST['Purple Fleur'];
echo $purplefleurqty." Purple Fleur";
echo "\n";
$goldfleurqty = $_POST['Gold Fleur'];
echo $goldfleurqty." Gold Fleur";
echo "\n";
$customqty = $_POST['Custom Add On'];
echo $customqty." Custom Add on";
echo "\n";
echo $shippingcost." S & H";
echo "\n";
$totalqty = 0; //setting variable type
$totalamt = 0.00;
define("FOLKLOREPRICE", 65); //setting constants for pricing
define("GREENFLEURPRICE", 40);
define("PURPLEFLEURPRICE", 40);
define("GOLDFLEURPRICE", 50);
define("CUSTOMADDPRICE", 75);
define("SHIPPINGCOST", 12.95);
$totalqty = $folkloreqty + greenfleurqty + purplefleurqty + goldfleurqty + customqty; //calc for quantity
$totalamt = $folkloreqty * FOLKLOREPRICE
+ greenfleurqty * GREENFLEURPRICE
+ purplefleurqty * PURPLEGLEURPRICE
+ goldfleurqty * GOLDFLEURPRICE
+ SHIPPINGCOST; //calculation for total
$totalamt = number_format($totalamount, 2); //setting 2 decimal places
echo "\n";
echo "Items Ordered: ".totalqty. "\n";
echo "Subtotal: ".totalamt. "\n";
$tax = .09; /*tax amount to be included in total*/
$totalamt = $totalamt * (1+$tax); //tax calculation to new total.
$totalamt = number_format($totalamt, 2); //setting format for total
if ($totalamt > "300")
{
echo "Shipping is Free!. Your total is: $" .$totalamt - 1;
}
else
echo "Total tax included: $" .$totalamt.;
echo "\n";