Wrox Programmer Forums
| 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 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 11th, 2003, 09:19 PM
Registered User
 
Join Date: Aug 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default help in Chapter 3

Here is the code in one html file I run first

<HTML>
<HEAD></HEAD>
<BODY>
<FORM method="get" action="text.php">
WHo is your favourite authors?
<input type=submit>
<br>
<input name="choice1" type="checkbox" value="111" checked >
<input name="choice2" type="checkbox" value="222" checked >
<input name="choice3" type="checkbox" value="333" checked >

</FORM>
</BODY>
</HTML>

then here is the code of text.php
<HTML>
<HEAD></HEAD>
<BODY>
Your favorite author is:
<?php
echo $aaa;
echo $choice1;
echo $choice2;
echo $choice3;
?>
</BODY>
</HTML>

when I just check some of the checkboxes and then press submit.
The wrong message show up as following:

Notice: Undefined variable: choice3 in c:\inetpub\wwwroot\text.php on line 9

but in the book, it only mentioned that the the checkbox not ticked will not be transfer to PHP engint and will not show its value. so is there any configuration in PHP to delete this Notice information?

Thanks!

Thanks!
 
Old August 13th, 2003, 05:14 AM
Registered User
 
Join Date: Aug 2003
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by lancet2003
Notice: Undefined variable: choice3 in c:\inetpub\wwwroot\text.php on line 9

but in the book, it only mentioned that the the checkbox not ticked will not be transfer to PHP engint and will not show its value. so is there any configuration in PHP to delete this Notice information?

You need to set the Error handling in your php ini file to how you want errors displayed.

 
Old August 13th, 2003, 11:11 AM
Registered User
 
Join Date: Aug 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks!

Thanks!
 
Old August 30th, 2003, 03:31 PM
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 6 Times in 6 Posts
Default

The book was written before the PHP group had decided to change the default value of error_reporting in php.ini. The best way to adapt your code is the write this equivelent: (You should also be using the $_GET[""] super global array)

<?php
if (isset($_GET["aaa"])) {echo $_GET["aaa"];}
if (isset($_GET["choice1"])) {echo $_GET["choice1"];}
if (isset($_GET["choice2"])) {echo $_GET["choice2"];}
if (isset($_GET["choice3"])) {echo $_GET["choice3"];}
?>

This code works with both of the new defaults set in php.ini, error reporting E_ALL and register_globals = off.

There are a multitude of reasons for adapting your code to work with these new standards!

See Nik's register globals FAQ:
http://p2p.wrox.com/archive/beginnin...2002-11/17.asp

And see this topic on error reporting:
http://p2p.wrox.com/topic.asp?TOPIC_ID=1709

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old July 28th, 2005, 12:53 AM
Registered User
 
Join Date: Jul 2005
Location: , Florida, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When I run the sample code by richard.york, I get no errors. Actually, the i.e. screen goes blank.  What could be causing this. I have errors set to E_ALL and register_globals = off I am using PHP5
 
Old September 25th, 2005, 01:39 PM
Registered User
 
Join Date: Sep 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, this answered my question.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 2 - End of chapter exercises whizzkid1892 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 July 30th, 2008 12:02 PM
chapter 7 - chapter 11 pelopito BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 3 January 6th, 2008 11:40 AM
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM





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