0

I'm building a navigation structure in a series foreach loops. This navigation currently works successfully, however it does not deal with the '&' character within URL's.

For example I have the following link code:

$nav .= "<li><a href='$url$item->catname/$item->subcatname/$subcat->subcatname'>".$subcat->subcatname ."</a>";

I have tried the following:

$nav .= "<li><a href=" . urlencode('$url$item->catname/$item->subcatname/$subcat->subcatname') . ">".$subcat->subcatname ."</a>";

Although this displays the php markup. What is the best solution here?

Liam Fell
  • 1,308
  • 3
  • 21
  • 39
  • http://php.net/manual/en/language.types.string.php – CBroe Mar 08 '16 at 12:38
  • You're using your [quotes](http://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php) wrong – DarkBee Mar 08 '16 at 12:44

0 Answers0