On 1/11/2011 7:35 PM, David McGlone wrote:
Hi Everyone, I'm having a problem validating some links I have in a foreach.
Here is my code:
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

my PHP code:
$categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us',
foreach($categorys as $category){
$replace = str_replace("_", " ", $category);
echo "<li><a href='index.php?page=$category'>$replace</a></li>";

Try this instead

echo '<li><a href="index.php?page=',$category,'">',$replace,'</a></li>';

Jim Lucas


Validator Error:
an attribute value must be a literal unless it contains only name characters

…ome>home</a></li><li><a href=index.php?page=services>services</a></li><li><a

I have tried various combinatons and different doctypes. I'm beginning to
wonder if this code is allowed at all.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to