JREAM Posted September 9, 2008 Share Posted September 9, 2008 Hey I can't get this to work right, the link is suppose to get the sub function while keeping the main function function showblocks() { print '<a href="?action=showblocks#block-1">Block1</a>'; print '<a href="?action=showblocks#block-2">Block2</a>'; if ($_GET['action'] == 'showblocks#block1') { block('block-1'); } elseif ($_GET['action'] == 'showblocks#block1') { block('block-2'); } } Link to comment https://forums.phpfreaks.com/topic/123382-action-link/ Share on other sites More sharing options...
JasonLewis Posted September 9, 2008 Share Posted September 9, 2008 It won't grab anything after the #. You can check this by echoing $_GET['action']. Why not make the link something like this: ?action=showblocks&block=1 Then grab them: $action = $_GET['action']; if(isset($action) && $action == "showblocks"){ $block = $_GET['block']; if($block == "1"){ echo "Block 1"; } } Link to comment https://forums.phpfreaks.com/topic/123382-action-link/#findComment-637282 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.