PHP

Moderators: None (Apply to moderate this forum)
Number of threads: 1848
Number of posts: 5016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
php code showing up on site Posted by javaNoob12 on 20 Feb 2013 at 4:56 PM
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 "<p>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";



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.