Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I am a bit of a noob and I am having trouble allowing the variables to be passes. I tried every permutation of declaring variables possible. I am at a loss. Any help would be greatly appreciated.
I can't seem to find anything about this in the existing posts.
my php ini reades "Note - track_vars is ALWAYS enabled as of PHP 4.0.3"
I am on a Windows machine.
First page:Code: Select all
<DOCTYPE HTML Public "-//w3c//DTD HTML 3.2//EN"
<html>
<head>
<TITLE> Bean counter form </TITLE>
</head>
<body>
<FORM method="POST" action="do_calculate.php">
<p>enter the price per bag of coffee beans: $ <INPUT type="text" name="price" size=10 maxlength=10></p>
<p> How many bags would you like? <INPUT type="text" name="quantity" size=10 maxlenght=10></p>
<INPUT type="submit" value="submit">
</FORM>
</body>
</html>Second Page:
Code: Select all
<body>
<?php
$sales_tax= .0825;
$sub_total = $price * $quantity;
$sales_tax_amount = $sub_total * $sales_tax;
$grand_total = $sub_total + $sales_tax_amount;
$fmt_price = sprintf("%0.2f", $price);
$fmt_sub_total = sprintf("%0.2f", $sub_total);
$fmt_sales_tax_amount=sprintf("%0.2f",$sales_tax_amount);
$fmt_grand_total_amount=sprintf("%0.2f",$grand_total);
$drink1= "cofee";
$drink2= "milk";
echo "<p> You ordered $quantity bags of coffee.</p>";
echo "<p> Bags of coffee are \$$fmt_price each. </p>";
echo "<p> Your subtotal is \$$fmt_sub_total.</p>";
echo "<p> Sales tax is \$$fmt_sales_tax_amount in this location.</p>";
echo "<p> \$$fmt_sales_tax_amount has been added to your order.</p>";
echo "<p> you owe \$$fmt_grand_total_amount for your coffee.</p>";
if (($drink1=="coffee") || ($drink2=="coffee")) {
echo "<p>I'm Happy</p>\n";}
else{
echo "I still need caffeine.";
}
?>
</body>Thanks
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]