It depends on the "error_reporting" setting in php.ini. czambran, you probably have yours set to E_ALL & ~E_NOTICE (which I believe is the default), which only shows fatal errors and warnings. Shawnrberg, my guess is that yours is set to E_ALL, which shows all errors, warnings, and notices.
There are two ways to remedy this -- 2 permanent solutions, and a temporary one. There are a couple of ways to do it temporarily.
One permanent solution is this: edit your php.ini file and find the line "error_reporting = E_ALL." Change it to "error_reporting = E_ALL & ~E_NOTICE." I do NOT recommend this. I almost always recommend to my clients that they set error_reporting to E_ALL. The reason is that even though most notices are non-fatal, they could be symptoms of larger problems. Good coding practice will help you to fix all problems, even notices, which brings us to the second permanent solution: Fix the notice by declaring your variables. In this particular case, a line that sets $total = "" will suffice to prevent the notice you got.
*Note: I realize the book does not always follow good coding practices. The book's job is to teach you basic concepts and techniques, and hopefully turn the reader into a decent PHP developer. It is not intended to turn you into a great coder, with good coding practices. If we tried to do that, much of the code would be lost on beginners, and the book would be 2000 pages long. However, whenever asked, I do like to encourage good coding practices.
Ok... the temporary solution (which I don't condone, but it will prevent the notice) is to use the function error_reporting() in your script:
error_reporting(E_ALL & ~E_NOTICE);
To suppress all errors (which I do NOT recommend):
error_reporting(0);
---------
Good coding practices take more time. But in the long run, they prevent more headaches and save you troubleshooting time.
For more information about error handling and logging, I recommend you take a look at this page:
http://us3.php.net/manual/en/ref.errorfunc.php
Michael K. Glass
Author, Beginning PHP, Apache, MySQL Web Development