Reply
PHP code won't validate
Old 06-01-2008, 07:36 AM PHP code won't validate
Average Talker

Posts: 21
Name: John Grafflin
Using
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
This line of my PHP code will not validate:

Code:
<td><a href="<?php echo $url; ?>" rel="external"><?php echo $hostname; ?></a></td>
I get the following errors, although the code works just fine:

Line 109, Column 20: XML Parsing Error: Unescaped '<' not allowed in attributes values.

Line 109, Column 20: XML Parsing Error: attributes construct error.

Line 109, Column 20: XML Parsing Error: Couldn't find end of Start Tag a line 109.

Line 109, Column > 80: XML Parsing Error: Opening and ending tag mismatch: td line 109 and a.

Line 109, Column > 80: XML Parsing Error: Opening and ending tag mismatch: tr line 108 and td.

Line 121, Column 11: XML Parsing Error: Opening and ending tag mismatch: table line 68 and tr.

Line 126, Column 10: XML Parsing Error: Opening and ending tag mismatch: div line 43 and table.

Line 228, Column 6: XML Parsing Error: Opening and ending tag mismatch: body line 28 and div.

Line 295, Column 7: XML Parsing Error: Opening and ending tag mismatch: html line 2 and body.

The page where the code resides is http://www.webhosting-depot.com/compare-hosts.php
jwgrafflin is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 06-01-2008, 07:39 AM Re: PHP code won't validate
Extreme Talker

Posts: 174
maybe do a php echo the whole thing

PHP Code:
<?php
echo'<td><a href="'.$url.'" rel="external">'.$hostname.'</a></td>';
?>
this code should work
simster is offline
Reply With Quote
View Public Profile
 
Old 06-01-2008, 07:44 AM Re: PHP code won't validate
Average Talker

Posts: 21
Name: John Grafflin
Quote:
Originally Posted by simster View Post
maybe do a php echo the whole thing

PHP Code:
<?php
echo'<td><a href="'.$url.'" rel="external">'.$hostname.'</a></td>';
?>
this code should work
That took care of the validation problem, but now the code doesn't work.

I stand corrected on that statement. The code doesn't work as an html document (that is, when I plug in the header, footer, etc. to the php document). But as a php document, it works just fine.

Last edited by jwgrafflin : 06-01-2008 at 07:49 AM.
jwgrafflin is offline
Reply With Quote
View Public Profile
 
Old 06-01-2008, 07:56 AM Re: PHP code won't validate
Extreme Talker

Posts: 174
thats good.

If you have any more problems just ask for a fix here.

(I do sometimes as well)
simster is offline
Reply With Quote
View Public Profile
 
Old 06-01-2008, 05:11 PM Re: PHP code won't validate
Arenlor's Avatar
Ultra Talker

Posts: 463
Name: Jerod Lycett
Location: /home/arenlor
First off you should try encoding your ampersands in links. After that, the error seems to be gone?
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 06-01-2008, 06:00 PM Re: PHP code won't validate
Average Talker

Posts: 21
Name: John Grafflin
Quote:
Originally Posted by Arenlor View Post
First off you should try encoding your ampersands in links. After that, the error seems to be gone?
There are no ampersands, so that does not apply here.

Last edited by jwgrafflin : 06-01-2008 at 06:03 PM.
jwgrafflin is offline
Reply With Quote
View Public Profile
 
Old 06-01-2008, 07:12 PM Re: PHP code won't validate
Arenlor's Avatar
Ultra Talker

Posts: 463
Name: Jerod Lycett
Location: /home/arenlor
http://validator.w3.org/check?uri=ht...Inline&group=0 there are many ampersands.
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 06-01-2008, 08:25 PM Re: PHP code won't validate
Average Talker

Posts: 21
Name: John Grafflin
Quote:
Originally Posted by Arenlor View Post
Yep, there certainly are if you check the whole document. And each of them is properly coded. The only thing that would not validate was the single line of code I submitted.

Once it was corrected, and only it, the page validated.
jwgrafflin is offline
Reply With Quote
View Public Profile
 
Old 06-02-2008, 10:01 PM Re: PHP code won't validate
Arenlor's Avatar
Ultra Talker

Posts: 463
Name: Jerod Lycett
Location: /home/arenlor
Actually there are 38 errors and it's invalid.
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 06-03-2008, 12:15 AM Re: PHP code won't validate
Average Talker

Posts: 21
Name: John Grafflin
Quote:
Originally Posted by Arenlor View Post
Actually there are 38 errors and it's invalid.
That's because you're testing the page after mysql data has been added. However, the raw page code does validate, which is all I'm concerned about right now.
jwgrafflin is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP code won't validate
 

Thread Tools

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.16391 seconds with 12 queries