php3 code does not work in php4
| From: | Jim Bailey | Date: | Tue, 06 Aug 2002 16:27:15 +0000 |
| Subject: | php3 code does not work in php4 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-111396@lists.php.net to get a copy of this message | ||
Hello,
May I begin by apologizing for the length of this post. I am brand new to
PHP and I don't know what you might need to help me. So I included all
I thought you might need. I hope someone can help me.
I'm new (Day 2) at the study of PHP. I'm using a book named PHP ESSENTIALS
by Meloni (writtten for PHP 3).
Using an example in the PHP3 book (Chapter 2- 'Basic PHP Techniques') When I
SUBMIT, I received the PHP echo text following four error messages.
The HTML form source follows:
<HTML>
<HEAD>
<TITLE>
BEAN COUNTER FORM
</TITLE>
</HEAD>
<BODY>
<FORM method = "POST" action="do_calculate.php">
<P>What is the price per bag?
<INPUT TYPE ="text" name = "price" size = 10 maxlengh = 10></P>
<P>How many bags would you like?
<INPUT type="text" name="quantity" size=10" maxlength = 10</p>
<INPUT type = "submit" value = "Submit">
</FORM>
<BODY>
</HTML>
Here is the page resulting from the submit
Notice: Undefined variable: price in
C:\FREEDEV\XITAMI\webpages\do_calculate.php on line 26
line 26: $sub_total = $price * $quantity;
Notice: Undefined variable: quantity in
C:\FREEDEV\XITAMI\webpages\do_calculate.php on line 26
line 26: $sub_total = $price * $quantity;
Notice: Undefined variable: price in
C:\FREEDEV\XITAMI\webpages\do_calculate.php on line 34
line 34: $fmt_price = sprintf("%0.2f",$price);
Notice: Undefined variable: quantity in
C:\FREEDEV\XITAMI\webpages\do_calculate.php on line 42
line 42 echo "<P>You ordered $quantity bags of coffee.</p>";
In addition I modified PHP.ini as by adding the following lines.
track_vars = on
register_globals = on
You ordered bags of coffee.
Bags of coffee are $0.00 each.
Your subtotal is $0.00.
Sales tax is 8.25% in this location.
$0.00 has been added to your order.
You owe $0.00 for your coffee.
Okay, that wasn't too bad, was it.
Thanks
Jim