Jump to content

[SOLVED] problems invovling link and validating


farban

Recommended Posts

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

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>';

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>';

ohh blimey it looks like it works with single quotues :D 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.