Well you won't have any problems once you get a grasp on the concepts.
With PHP, each method is named, so once you get a handle on what's going on it'll be very easy to sort out which variables should be what.
The books don't do a very good job of explaining register globals. I personally had no idea that each variable has its own corresponding super-global array until I happened to subscribe to the PHP forums here on wrox.
You should get to know the super-global arrays and adapt whatever code you learn from a book to work with those instead of those that are created from register globals.
I don't think that you have to buy another book, necessarily, I have maybe six PHP books lying around and most of them haven't done anything for me. The big help for me was these forums and the PHP website... which is difficult to understand at first, as a newbie, because everything is written for the PHP savvy, not the begginer. But once you begin to understand how things work, becomes an invaluable tool. I think my most used book was the Beginning PHP book from wrox.
The super global arrays work like this:
$_POST - Is an array of variables containing data submitted via the post method of an HTTP request. Its set-up like this..
If you have an HTML form field declared like so;
<form method="post" action="my_script.php">
<input type="text" size="20" name="my_name" value="hello, world" />
You would probably see it referenced in your book like this;
This method relies on the register globals function...
The correct way, which does not rely on register globals is this:
Which is a little easier to understand and when you get into more complicated scripts is also more secure and comes in very handy when dealing with functions and classes. And not to mention makes understanding the flow of your code much easier.
There are several of these super-global arrays, each having its own usefullness.
You may see for instance a reference to something like this in one of your book's examples...
Which again has security issues... it should be referenced like this, no need for the global keyword!
Well I'm sorry I can't get more deeply into the whole variable, super-global relationship...
Here is the most important URL you will ever need when dealing with PHP:
Here is the specific page on super-global variables:
My suggestion is read this page! And when you go to learning new concepts, reference this page to see if any of the variables that you are using could fit into one of these categories. Such as, variables that are written in all uppercase probably fit into the $_SERVER array, data submitted from forms fit into either the $_POST or $_GET array, depending on the method. URL query strings are the $_GET method. $_COOKIE, well its self-explanatory really. And finally $_SESSION is meant for data persistence... which is another subject all its own.
And if all else fails you've always got the PHP forums!