Re: Newby variable error
| From: | graeme | Date: | Thu, 16 Sep 2004 02:44:59 +0000 |
| Subject: | Re: Newby variable error | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-36214@lists.php.net to get a copy of this message | ||
Hi,
first step in debugging...learn to love the var_dump() function :)
just add the following code to the do_calculate.php function
...
<?php
var_dump ($_POST);
echo "<br>";
// set up the pricing assignments
...
This will display what is held in your $_POST variable. When you run the script at the start of your output will be the following
array(2) { ["beans"]=> string(16) "Ethiopian Harrar" ["quantity"]=> string(1) "3" }
Notice that beans and quantity are in double quotes.
From now it should be east to fix ;)
graeme.
W Roothman wrote:
Wizards, I am VERY new to PHP, paging through Meloni's 'PHP Essentials' I get the following error which I assume is very simple to solve, but for me. I have tried different approaches in identifying the 'price' variable with no luck: error: Notice: Undefined variable: price in c:\inetpub\wwwroot\php exercises\do_calculate.php on line 20 Notice: Undefined variable: price in c:\inetpub\wwwroot\php exercises\do_calculate.php on line 24