Jump to content

$_GET['q']; after a #fragment ?


Kez323

Recommended Posts

Hi, I need help getting this thing to work, I'm not sure on how to $_GET[] data after a fragment in the URL. I've seen it used on websites before, for example:

 

example.com/#home?q=test

 

A working example is: http://craftland.org/#map&p=aether

 

This is the code I'm using for the pages:

 

http://pastebin.com/vAHppEyr

 

 

Any help would be great!

 

Thanks, Kez.

Link to comment
https://forums.phpfreaks.com/topic/286319-_getq-after-a-fragment/
Share on other sites

You cant get that value in PHP, as whatever is after the # in the url it is not passed in the request to the server.

 

What is happening in craftland is they are using jquery to get the hash, and then deciding what page load. Then the page is loaded using ajax.

It depends on what you mean by 'transferring' data... If you want to pass variables from one page to another, you can use $_SESSION to store values, you can write them to a database and read them again on the next page, you can write them to text files, etc... $_GET and $_POST are more widely used for submitting stuff through the browser, like forms a user has to fill in, etc... 
 

We could give you a much better answer if you explain exactly what you're trying to do.

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.