farban Posted May 23, 2008 Share Posted May 23, 2008 Hello there i am required by my college for my site to be valid in xhtml strict. i have a certian peice of code on my links page so that when the user clicks on the links varible it will go to that page // create the article list $messege = '<ol>'; while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($l_id, $ltitle, $lname) = $row; $messege .= "<li>$ltitle</li><li><a href=$lname>$lname</a></li>\r\n"; } but when validating it for xhtml strict it dosent like it one bit it says: Error Line 99, Column 35: an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified . <ol><li>SCO forums</li><li><a href=http://scoclan.15.forumer.com/>http://scoclan # Error Line 99, Column 41: NET-enabling start-tag not immediately followed by null end-tag . …<li>SCO forums</li><li><a href=http://scoclan.15.forumer.com/>http://scoclan. ✉ This error may occur when there is a mistake in how a self-closing tag is closed, e.g '.../ >'. The proper syntax is '... />' (note the position of the space). any help on changing this peice of code so that it validates and dosent break it at the same time ? Added code tags ~ CV Link to comment https://forums.phpfreaks.com/topic/106951-solved-problems-invovling-link-and-validating/ Share on other sites More sharing options...
947740 Posted May 23, 2008 Share Posted May 23, 2008 Do you close the <ol>? Link to comment https://forums.phpfreaks.com/topic/106951-solved-problems-invovling-link-and-validating/#findComment-548174 Share on other sites More sharing options...
farban Posted May 23, 2008 Author Share Posted May 23, 2008 ye sorry i didnt put that bit in $messege = '<ol>'; while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($l_id, $ltitle, $lname) = $row; $messege .= "<li>$ltitle</li><li><a href=$lname>$lname</a></li>\r\n"; } $messege .= '</ol>'; Link to comment https://forums.phpfreaks.com/topic/106951-solved-problems-invovling-link-and-validating/#findComment-548176 Share on other sites More sharing options...
947740 Posted May 23, 2008 Share Posted May 23, 2008 You need quotes or something around the $lname after the href= $messege = '<ol>'; while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($l_id, $ltitle, $lname) = $row; $messege .= "<li>$ltitle</li><li><a href='$lname'>$lname</a></li>\r\n"; } $messege .= '</ol>'; Link to comment https://forums.phpfreaks.com/topic/106951-solved-problems-invovling-link-and-validating/#findComment-548180 Share on other sites More sharing options...
farban Posted May 23, 2008 Author Share Posted May 23, 2008 yea the problem is though if i do that ..it breaks the php because the varible is set in double quotues ...im not sure how to by pass it Link to comment https://forums.phpfreaks.com/topic/106951-solved-problems-invovling-link-and-validating/#findComment-548188 Share on other sites More sharing options...
947740 Posted May 23, 2008 Share Posted May 23, 2008 Use \" or single-quotes (') instead of ". I used single-quotes in my example, and those will not break the PHP. Link to comment https://forums.phpfreaks.com/topic/106951-solved-problems-invovling-link-and-validating/#findComment-548199 Share on other sites More sharing options...
farban Posted May 23, 2008 Author Share Posted May 23, 2008 ohh blimey it looks like it works with single quotues i thought that i had to use doubles $messege = '<ol>'; while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($l_id, $ltitle, $lname) = $row; $messege .= "<li>$ltitle</li><li><a href='$lname'>$lname</a></li>\r\n"; } $messege .= '</ol>'; here is the fixed version hope it helps anyone out there who has the same problem and it validates Link to comment https://forums.phpfreaks.com/topic/106951-solved-problems-invovling-link-and-validating/#findComment-548200 Share on other sites More sharing options...
947740 Posted May 23, 2008 Share Posted May 23, 2008 Glad to help. Link to comment https://forums.phpfreaks.com/topic/106951-solved-problems-invovling-link-and-validating/#findComment-548202 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.