David
David

Reputation: 4508

how to read what I enter in address bar in php and getting data from it

I want to enter mysite.com/#test1 in address bar . My site is configed so that index.php will load. And I want to read mysite.com/#test1 in php so php could work with that string getting test1 out of the address. Is that possible ?

This

echo $_SERVER['PHP_SELF'];

gives me only

index.php

While in address bar I have mysite.com/#test1

Upvotes: 0

Views: 287

Answers (3)

Mob
Mob

Reputation: 11106

Any string after a # in a URL is not sent to a server.

How about passing values like mysite.com/index.php?variable=

You can use a $_GET to get the value.

Upvotes: 0

Sjoerd
Sjoerd

Reputation: 75629

The part after the hash is not sent to the server, so it is not possible to access it using PHP.

You could read it using Javascript and then submit it to the server.

Upvotes: 5

kaydara
kaydara

Reputation: 7

print_r( $_SERVER );

and choose the best for you

Upvotes: -3

Related Questions