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