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, 11:20 AM
Registered User
 
Join Date: Aug 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default what is the problem of T_VARIABLE in Chapter 3?

when I run the following code, there also shows
Parse error: parse error, unexpected T_VARIABLE in c:\inetpub\wwwroot\hidden.php on line 5


<HTML>
<HEAD></HEAD>
<BODY>
<? php
$Message1="Bugs Bunny"; THERE IS A PROBLEM HERE
$Message2="Homer Simson";
$Message3="Ren & Stimpy";
echo "<FORM method="get" action="text.php">;
echo "what price of car are you looking for":
echo "<SELECT name="Price";
echo "<OPTION> $Message1</OPTION>";
echo "<OPTION> $Message2</OPTION>";
echo "<OPTION>$Message3</OPTION>";
echo "</SELECT><br>";
echo"<input type=hidden name=hidden value='$Message1'>";
echo"<input type=hidden name=hidden value='$Message2'>";
echo"<input type=hidden name=hidden value='$Message3'>";
echo"<input type=submit>";
echo"</Form>"
?>
</BODY>
</HTML>

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

echo "<FORM method="get" action="text.php">;
should be:
echo "<FORM method=get action='text.php'>;
also,

echo "what price of car are you looking for": <- should be a ;

hope this helps...
Oregon
 
Old August 30th, 2003, 03:16 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Actually this is terrible advice:
Quote:
quote:
echo "<FORM method="get" action="text.php">;
should be:
echo "<FORM method=get action='text.php'>;
Emerging HTML standards are becoming more and more strict with each new browser release. All HTML attributes should be written in name, value pairs with all values quoted. HTML tags should be written in all lowercase letters, as future versions of HTML are going to be case-sensitive. This is actually mentioned somewhere in the beginning of Beg. PHP 4. There are a multitude of other things that should be done to make html code compatible with the emerging standards, HTML 4.01 and XHTML. For the most part this code is always back-wards compatible.

So you should writing this:
<form method="get" action="text.php">

The <br> tag is deprecated under HTML 4.01, and should be written as: <br />
The XHTML standard states that all tags should have both an opening and closing tag and includes the slash method as a shortcut for those tags which do not already have both an opening and closing tag.

so:
<img src=".../file.jpg">

should be:
<img src=".../file.jpg" alt="" />
The alt attribute is required under HTML 4.01

Old tag attributes like
width="100" height="100"

Are now deprecated and should be replaced with CSS equivalents
style="width: 100; height: 100;"

Single name attributes should be written as name, value pairs
<select size=4 multiple>

Should be written as:
<select size="4" multiple="multiple">

This new method even works on older browsers and is 100% XHTML compliant!

And this just scratches the surface, there are several deprecated tags that are still used everyday. Why Beg. PHP 4 is so sloppy in terms of HTML standards compliance, I dunno.

My advice is don't be lazy, if you intend to write professional HTML code get to know the standards. Get a hold of Wrox's HTML 4.01, a fantastic and very thorough book! Even if you THINK you're an HMTL expert, you probably aren't! I thought I was pretty savvy, hell I had taken a college course on writing HTML, and I learned quite a bit from this book.

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old August 30th, 2003, 04:09 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Also, don't forget to escape quotes!
<form method=\"get\" action=\"text.php\">



:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old August 30th, 2003, 05:31 PM
Authorized User
 
Join Date: Jul 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Rich, I just wanted to say thanks for taking the time to straighten me out. I just couldn't seem to get stuff to work and found "other ways" around it. Yeah these books could be better, but for a novice like me, ya gets what ya pays for, huh?

I'm glad to see someone cares. I'm still not sure about the book feedback thing. If you're reporting errata, there's another place to do it on the site. If it's book feedback, there already seems to be a place for that too. I was under the impression that this was a programmer to programmer board, based on a message from another thread on this site by a moderator that pointed this way (I thought).

Anyway, if you know of a better forum, I sure would like to know of one. I'm going to order that HTML book. My HTML is very weak.

Thanks again,
Oregon

 
Old August 30th, 2003, 05:50 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Hi Oregon,
No problem at all! I was in exactly the postion that you're in now when I started learning PHP, although at the time I didn't have to deal with the register_globals directive being off by default.
Beg. PHP 4 is actually a pretty good book... lacks on HTML standards and certainly isn't up to par on the best way to do *some* things in PHP. As far as reading goes I thought it was easier to follow than many of the other PHP books out there, which I have something like 6 sitting around. Its just outdated, that's all! I'm sure wrox has a PHP 5 book in the works that will answer many of the problems left behind by the out-of-date Beg. PHP 4.
Like I said in another post on here earlier I didn't even know this board existed until today. I was board and decided to look at some of the other forums. Many of us PHP gurus that got started on the old wrox are hanging out on the PHP boards under open source, php and linux. I can see that no one else has stumbled across this board either or there would be better responses to the questions. After reading some of the posts on here I realize that I could easily spend all day on here setting things straight!
The best thing that you can do is get to know the PHP manual intimately, join the rest of us on the other boards because just reading the posts here on wrox is also helpful in gaining expertise! The php manual is hard to read at first because it is written for the PHP programmer, not the novice. But is certainly an invaluable tool! Everything that you need to know about PHP is somewhere in the manual. The wrox books help to see concepts in action, but to truly know how something is supposed to work, its best to get on php.net and read the manual.

: )
Rich





:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old October 24th, 2003, 09:25 AM
dre dre is offline
Registered User
 
Join Date: Oct 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to dre
Default

dewd ..... the problem is that there is a SPACE in the tag <? php. it should read <? or <?php. Take it out and it should work fine. That is y u get that error.

Soz... i jsut had to post this, as none of the stuff above actually answers lancet2003's question :D
*slapself*

l8ers ya'll.
dre






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 6 Problem Dennis Mollet BOOK: Beginning VB.NET Databases 1 August 15th, 2005 01:56 PM
T_VARIABLE goobywaj BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 March 28th, 2005 05:06 PM
Unexpected T_VARIABLE deamato BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 February 26th, 2005 08:11 PM
Unexpected : t_string, t_variable, t_num_string scifo PHP Databases 13 November 15th, 2004 05:08 AM





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