PHP Variables?
| From: | Mike | Date: | Tue, 11 Feb 2003 19:37:43 +0000 |
| Subject: | PHP Variables? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-3698@lists.php.net to get a copy of this message | ||
Newbie here with a question,
My web host is running PHP 4.2.3 and I am running PHP 4.3.0 locally.
Whenever I try to test a page that accepts variables (either from a form or
by attaching them to the URL when calling the .php page) I get errors saying
that the variables are 'undefined'. However, if I upload the same code to my
web host it works fine.
Did something change in 4.3.0? Am I missing something? I'd like to be able
to code and test the pages locally without having to upload them everytime I
want to test them.
I am running PHP against IIS 5 on WinXP, the web host is using Apache. The
code is listed below.
Thanks for any help.
<html>
<head>
<title>Conditionals</title>
<link href="./style/styles.css" type="text/css"
rel="stylesheet">
</head>
<body>
<table bgcolor="#9999cc" width="100%" height="100">
<tr>
<td><a href="http://www.php.net/"><img
src="images/php_logo.gif"
border="0"/></a></td>
</tr>
</table>
<?php
/* $Quantity must be passed to this page from a form or via the URL.
$Discount is optional */
$Cost = 2000.00;
$Tax = 0.06;
if (isset($Quantity)){ print ("No value passed");}
if ($Quantity) {
$Quantity = abs($Quantity);
$Discount = abs($Discount);
$Tax++; // Tax is now worth 1.06
$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, comes to $");
printf("%01.2f", $TotalCost);
print (".\n<p>You may purchase the widget(s) in 12 monthly installments of
$");
printf("%01.2f", $Payments);
print (" each.\n<p>");
}
?>
</body>
</html>