Wrox Programmer Forums
|
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 13th, 2003, 05:19 AM
Registered User
 
Join Date: Aug 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default register_globals=Off

Is there any updated code for the now standard register_globals=Off? I'm just starting to re-work through my book but would like all examples to work with globals off.

 
Old August 14th, 2003, 01:24 AM
Authorized User
 
Join Date: Jul 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I couldn't find the reference page in the book, but if you're using, for example: <FORM METHOD=POST in the calling script (ie HTML), then just use a variable declaration at the beginning of the called script (ie PHP) using the

$IncomingVariable = $_POST["IncomingVariable"];
format.
Same goes with METHOD=GET:

$IncomingVariable = $_GET["IncomingVariable"];

As an example, in Chapter 3, the text.html example is sending the $Author variable to text.php. The METHOD=GET is used, so you might have this typed in the text.php file:

$Author = $_GET["Author"];

The variable getting the assignment: $Author could easily be named $IncomingVariable, but the second Author (in quotes and brackets) would match the name of the variable sent.

Later chapters talk of other methods of passing variables as well.

Oregon
 
Old August 14th, 2003, 02:49 AM
Registered User
 
Join Date: Aug 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply. Actually I have been changing the examples of chapter 3 in the way you were describing but I have been running into problems nevertheless.It would be nice if Wrox could supply updated code for the book. As far as I know, globals off is now the recommendation and all code should now be written that way. Is it true that php5 will not even allow globals on?

 
Old August 14th, 2003, 12:47 PM
Authorized User
 
Join Date: Jul 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't know about the PHP5 thing. I just remember good coding practice from the older (Pascal etc.) days. I've been using the book examples and have been using the POST method mostly, since GET splashes the info for all to see. My brother's been a software pogrammer for years and talked me into getting Homesite5. It rocks!

Oregon
 
Old August 15th, 2003, 03:37 PM
Registered User
 
Join Date: Aug 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Aha, this is what I've been looking for:
http://p2p.wrox.com/archive/beginnin...2002-11/17.asp






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 8 and register_globals off Oregon BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 July 26th, 2005 03:26 PM
PHP - register_globals off/on Tachyon Beginning PHP 2 May 18th, 2004 07:38 PM
Does the code work with register_globals off? GraphicArmy BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 April 6th, 2004 10:10 PM
register_globals lunadellest Beginning PHP 1 September 20th, 2003 11:33 AM
Beginning PHP4 register_globals=Off Cambo BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 August 30th, 2003 02:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.