Quote:
quote:Originally post by bbforrester
The only help that I can offer is to buy a new book. I tried to get help from Wrox and got a form letter response. I returned my book and got Teach Yourself PHP in 24 Hours by Sams Publishing. Best of luck.
|
Complaining to the subscribers of this list isn't going to do you any good -- we're not Wrox/Wiley employees -- and this does nothing to help hongxxxx with his/her problem.
This problem relates to the register_globals setting. I *don't* own a copy of this book anymore, so I don't remember what all went into this exercise.
Here are my suggestions for successfully getting through this and future exercises.
1.) Do a little background research on what the register_globals setting _is_... Nik and I have answered a plethora of questions on the topic and likewise since the setting was made to 'off' by default, nearly every example in the book affected by this has been questioned by someone at one point or another on the p2p forums.
Search:
http://www.google.com/search?q=regis...e:p2p.wrox.com
2.) Once you understand what it is and what it does, turn it back on in php.ini so you can understand and progress through the book's exercises.
Open the php.ini configuration file.. This file is located in the Windows directory on a windows box, not sure where it is on linux.. but it can be opened with a plain text editor.
It would be found at C:\Windows or where ever windows is installed.
Find the line that looks like this:
register_globals = off
Replace it with:
register_globals = on
Find the error_reporting line and modify it to this:
error_reporting = E_ALL & ~E_NOTICE
Restart the HTTP server if necessary.
Now the enviornment of the book's authors is recreated.
Once you feel confident in your understanding of basic concepts, learn how to work with register_globals = off and error_reporting = E_ALL. As the former is a deprecated setting, meaning that future versions of PHP aren't required to support it. The latter provides a more detailed level of error_reporting.
Writing code to the old settings is no longer considered good practice. Is the Wrox book a bit dated? Yes! But that doesn't mean you can't still get some use out of it.
That being said, a word on your code:
$_POST["FirstName ", "$LastName"],
The $_POST variable is an array that is populated from the various input fields of a POST method HTML form. This array cannot hold a reference to more than one piece of data at the same time, so the above is not correct.. each indice must be referenced individually. The above should have resulted in a parse error.
Here is a working alternative...
echo "Yes, {$_POST['FirstName']} {$_POST['LastName']}, we are delighted to accept ur aplication";
This makes use of curly syntax which allows PHP to drop out of normal string parsing mode whereas the variable contained in curly braces will be substituted for the proper value. This is handy for arrays with multiple levels of nesting, object properties, or you guessed it, plain ole variables.
There are other ways of referencing variables as well..
Have a look at the PHP manual page on strings.
http://us4.php.net/manual/en/language.types.string.php
hth,
: )
Rich
::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::