Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP 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 July 26th, 2003, 01:59 PM
Registered User
 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 5 page 150 - Wondering why....

In the last part of loan2.html the code reads...

"How much do you want to pay a month?
<INPUT NAME=Month TYPE=text SIZE=5>"

Why are there no quote marks around Month? It seems to work either way (with or without the quote - I tried), but in earlier examples of naming user data input, quote marks are put around the name. Does it matter whether or not I use quotes?
Seems like it should. Any help is appreciated. Thank you!



 
Old July 26th, 2003, 02:34 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

It doesn't matter if you are using a loose HTML interpreter 'Docutype' setting. Like 'Transitional'. If you want to be strictly HTML 4.01 compliant or XHTML compliant then the statement should be written like this:

<input type="text" name="month" value="" size="5" />

Each value should be enclosed within quotes, you should stick to all lowercase letters (future versions of HTML are going to be case-sensitive). And use a slash to close the tag for tags which have no opening AND closing tag already (for XHTML compliance). The XHTML standard states that all tags must have both an opening and closing tag and uses the slash method as a shortcut for tags which do not already have a closing tag like (br, img, input, meta, etc.).

Even if you consider yourself to be pretty HTML savvy, it wouldn't hurt to pick up a copy of wrox's HTML 4.01 book, which has loads of information about the docutype setting and pretty much tells all there is to know about HTML and where its going. I was very pleased with the book. It helped me to understand a lot of the nuisances between browsers.

My advice is don't be lazy! Get used to the standards now! This will guarantee that your code won't break on future browser releases.

: )
Rich



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

Oh and single name attributes should be written as name, value pairs,

Like so:

<select size="4" name="my_select" multiple="multiple">
<option value="my_value">My option text</option>
</select>

The old way of writing this was:

<select size=4 name=my_select multiple>
 <option value=my_value>My option text
</select>

This is very sloppy and should be avoided! It takes just a few extra keystrokes to do this to standards compliance. The second example should by all rights break under a strict docutype setting.

: )
Rich



:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old July 27th, 2003, 12:05 AM
Registered User
 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the prompt response Rich!

Best,
Karen






Similar Threads
Thread Thread Starter Forum Replies Last Post
More than 150 Ajax links ajax JSP Basics 2 January 20th, 2007 02:46 AM
Wondering how I'd go about doing this Smythe Classic ASP Basics 8 July 20th, 2006 08:28 AM
Wondering why .UDL for connecting string shailu BOOK: Beginning ASP 3.0 3 May 17th, 2005 07:39 AM
VB.net 2K3 Ch. 5 Confusion page 150 ralphtrent BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 5 June 9th, 2004 12:30 PM
CH5 pg 150 While Loops wadesmart BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 11 November 8th, 2003 04:51 PM





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