I'm a beginner of PHP, I downloaded the newest verion of php from php.net. I started to try some tutorials like this:
<?php
$Cost = 2000.00;
$Tax = 0.06;
if($_GET[Quantity]) {
$Quantity = abs($_GET[Quantity]);
$Discount = abs($_GET[Discount]);
$Tax++;
$TotalCost = (($Cost * $Quantity) - $Discount) * $Tax;
$Payments = (round($TotalCost, 2) / 12);
//Print the results.
print("You requested to purchase $Quantity widget(s) at \$$Cost each.\n<p>");
print ("The total with tax, minus your \$$Discount, coumes to $");
printf("%01.2f", $TotalCost);
print(".\n<p>You may purchase the widgets(s) in 12 monthly installments of $");
printf("%01.2f", $Payments);
print("each. \n<p>");
}
?>
After ran the page, there couples of craps came up like:
Notice: Use of undefined constant Quantity - assumed 'Quantity' in Calculate.php on line 11
Notice: Undefined index: Quantity in Calculate.php on line 11
Anybody know how to solve it? And also please tell me where I can the up-to-date tutorials of PHP, cause I followed some of the examples from other web sites and there are not work. Just like the tutorials told me to use $Quantity to receive the passed value. But I found that the correct one is $_GET[Quantity]. So please help. Thanks everyone.
Please help
Moderator: General Moderators
-
pootergeist
- Forum Contributor
- Posts: 273
- Joined: Thu Feb 27, 2003 7:22 am
- Location: UK
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Have a read of the 'Array do's and don'ts' section on this page:
http://www.php.net/manual/en/language.types.array.php
Mac
http://www.php.net/manual/en/language.types.array.php
Mac