Re: Newby variable error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux