Jump to content

[SOLVED] Passing variable AND an href target in the URL


Iki

Recommended Posts

URL's to some pages on my site pass a variable, like this:

http://www.mysite.com/games.php?type=scifi

 

On any of those game pages there could be more than 1 post. I'd like to mark them using href anchors so I can link directly to a certain post. I've got a unique identifier for each post that I can use for this purpose. What I want to know is, how do I pass the anchor identifier (say, #123abc ) while also passing the "type" variable (say, type=scifi )?

 

Thanks in advance for any help!

 

Iki

What the king (of php not pop) was just giving you an example.  You can set up your links like this...

 

http://www.mysite.com/games.php?type=scifi&anchor=#123abc

 

Then on the "games.php" page you could do the following...

<?php

$type = $_GET['type'];
$anchor = $_GET['anchor'];

//then later use these variables in your page to search or whatever it was you were trying to do with them.

?>

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.