Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 15th, 2004, 07:50 AM
Registered User
 
Join Date: May 2004
Location: , VA, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch3, P.76 - text.html/text.php not working

I have gone over my code a dozen times and I get the same error with my code and the code supplied from the Wrox site. The error is:

Code:
Your favorite author is: 
Notice: Undefined variable: Author in C:\Program Files\Apache Group\Apache2\htdocs\wrox_examples\ch03\text.php on line 6
Here is the form page, text.html:
Code:
<HTML>
<HEAD></HEAD>
<BODY>
<FORM METHOD=POST ACTION="text.php">
Who is your favorite author?
<INPUT NAME="Author" TYPE="TEXT">
<BR>
<BR>
<INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
and text.php
Code:
<HTML>
<HEAD></HEAD>
<BODY>
Your favorite author is:
<?php
echo $Author;
?>
</BODY>
</HTML>
I'm running:

Apache 2.0.49
PHP 4.3.6
on Windows 2000 Server

Any ideas?

TIA

Reply With Quote
  #2 (permalink)  
Old May 15th, 2004, 07:57 AM
Registered User
 
Join Date: May 2004
Location: , VA, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found a topic about turning register_globals to "On" and I did, now this works. I've also read this should be turned off in a production environment. How is this going to effect the code that I am learning in this book when I start creating my own applications?

Reply With Quote
  #3 (permalink)  
Old May 15th, 2004, 08:06 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Iain,

register_globals just automatically sets all superglobal variables (i.e. $_POST and $_GET) to normal variables like $name and $author.

The downside:

Security

Take this page, for instance, that you want no one but those logged in to access. register_globals is on and the session variable is $name.

<?php

session_start();

if($name)echo "Welcome!";

else header("Location: error.php");

?>


Say this page is index.php. If someone access it like this: index.php?name=whatever then $name will be whatever, and anyone could access the page that way. The easiest workaround is to turn off register_globals and access superglobals with $_POST, $_SESSION, etc.

HTH,

Snib

<><
Reply With Quote
  #4 (permalink)  
Old May 15th, 2004, 10:15 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Hi Hostile,
As you can imagine this topic has come up quite a bit, rather than beat a dead horse reiterating all the information conveyed countless times in previous posts, have a read of Nik's register_globals FAQ, then try a google search.

http://p2p.wrox.com/archive/beginnin...2002-11/17.asp
http://www.google.com/search?q=regis...e:p2p.wrox.com

After exploring the archives a bit, if you still have questions about it, let us know.


Regards,
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
Reply With Quote
  #5 (permalink)  
Old May 15th, 2004, 11:09 AM
Registered User
 
Join Date: May 2004
Location: , VA, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the help guys.††I'll take a look at those links Richard.

Cheers

Iain
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Text To HTML sumith ASP.NET 2.0 Basics 1 October 25th, 2007 02:26 AM
how to extract text from html??? naureen Java Basics 2 October 2nd, 2007 11:19 AM
HTML text interpretation omsadgamaya Crystal Reports 2 September 15th, 2006 07:23 AM
HTML text search JAtkinson VS.NET 2002/2003 0 February 29th, 2004 09:17 PM
Formatted/HTML text pkgal79 HTML Code Clinic 2 June 18th, 2003 02:18 AM



All times are GMT -4. The time now is 11:39 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.