ShoeLace1291 Posted February 20, 2008 Share Posted February 20, 2008 I have two arrays, the first builds the references and names of the links, the second builds the html for the links. I do this because I want to use implode to display a bullet in between them. This is my code: if($result['accnt_found']){ $link = array( 'link1href' => "index.php", 'link1name' => '', $board['name'], ' Home', 'link2href' => "logout.php", 'link2name' => "Logout", 'link3href' => "profile.php", 'link3name' => "My Profile", 'link4href' => "members.php", 'link4name' => "Members", 'link5href' => "events.php", 'link5name' => "index.php?act=events", 'link6href' => "index.php?act=help", 'link6name' => "Help" ); $buttons = array( 'link1' => '<a href="', $link['link1href'], '" name="', $link['link1name'], '">Index</a>', 'link2' => '<a href="', $link['link2href'], '" name="', $link['link2name'], '">Logout</a>', 'link3' => '<a href="', $link['link3href'], '" name="', $link['link3name'], '">Profile</a>', 'link4' => '<a href="', $link['link4href'], '" name="', $link['link4name'], '">Members</a>', 'link5' => '<a href="', $link['link5href'], '" name="', $link['link5name'], '">Events</a>', 'link6' => '<a href="', $link['link6href'], '" name="', $link['link6name'], '">Help</a>' ); echo ' ', implode(' • ', $buttons) ,' '; It doesn't display anything. Link to comment https://forums.phpfreaks.com/topic/92036-link-array/ Share on other sites More sharing options...
akitchin Posted February 20, 2008 Share Posted February 20, 2008 i suspect it's because you've got a syntax error in there somewhere. have you tried print_r()ing the arrays right after defining them to see if they are even made? Link to comment https://forums.phpfreaks.com/topic/92036-link-array/#findComment-471347 Share on other sites More sharing options...
priti Posted February 20, 2008 Share Posted February 20, 2008 curious to know about this ...is it a single string or array of string 'link1name'??? 'link1name' => '', $board['name'], ' Home', Link to comment https://forums.phpfreaks.com/topic/92036-link-array/#findComment-471352 Share on other sites More sharing options...
mainewoods Posted February 20, 2008 Share Posted February 20, 2008 'link1' => '<a href="', $link['link1href'], '" name="', $link['link1name'], '">Index</a>', in code like the above, you seem to be using a ',' when you should be using a '.' (concatenation operator) Link to comment https://forums.phpfreaks.com/topic/92036-link-array/#findComment-471354 Share on other sites More sharing options...
ShoeLace1291 Posted February 20, 2008 Author Share Posted February 20, 2008 That didn't help, mainewoods. I added print_r($button['link1']); after the $button array is defined, but still nothing is displayed. Link to comment https://forums.phpfreaks.com/topic/92036-link-array/#findComment-471356 Share on other sites More sharing options...
mainewoods Posted February 20, 2008 Share Posted February 20, 2008 my code above shows syntax errors. it may not be the only syntax errors. when php has syntax errors, it never executes because it fails at interpretation. you need to turn syntax errors on. Link to comment https://forums.phpfreaks.com/topic/92036-link-array/#findComment-471407 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.