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

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.