href syntax...

PHP Dei,
[php]<?php
$pagenames = Array(“datruth.php”, “members.php”, “military.php”, “government.php”, “diane.php”, “contact.php”, “drugs.php”, “employment.php”);
foreach( $pagenames as $value )
{
echo ‘<a href="’.$value.’".>
’;
}
?>[/php]
It is simple, but I cannot figure it out… Please help!!! Thanx ahead…

Maybe something like this?

[php]<?php
$pagenames = Array(“datruth.php”, “members.php”, “military.php”, “government.php”, “diane.php”, “contact.php”, “drugs.php”, “employment.php”);
?>
<!doctype html>

Links nav ul li { list-style: none; } nav ul li a { display: block; float: left; width: 125px; height: 40px; border-right: 2px solid #fff; background-color: orange; font-family: Arial, Helvetica, sans-serif; font-size: 1.0rem; line-height: 40px; color: #fff; text-decoration: none; text-align: center; text-transform: capitalize; }
nav ul li a:hover {
	background-color: magenta;
}
    <?php foreach( $pagenames as $value ) { $linkName = str_ireplace('.php', '', $value); echo '
  • ' . $linkName . '
  • '; } ?>
[/php]

L O L Or, just take out the extra PERIOD after the quote!

echo ‘<a href="’.$value.’".>
’;

Should be:

echo ‘
’;

No such thing as a period in this HTML format: <a href="…".> Should be

Hope that helps!

So there’s an extra period in the tag and I missed it, big deal. Still doesn’t help the OP for he still should close the anchor tag and learn HTML/CSS styling. for putting
at then end of an anchor tag is poor HTML.

While the code wouldn’t validate, it does work and to fix it just
[php]echo ‘

  • ’ . $linkName . ‘
  • ’;[/php]
    Now wasn’t that easy. :-\

    Yes, we are both correct. My mind stopped at the extra period… Sorry for that…

    Sponsor our Newsletter | Privacy Policy | Terms of Service