Jump to content

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


Kez323
Go to solution Solved by Ch0cu3r,

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.

Edited by Kez323
Link to comment
Share on other sites

  • Solution

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.

Edited by Ch0cu3r
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.