Jump to content

action link


JREAM

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.