Anil D
Anil D

Reputation: 2009

Get URL variable in PHP

I m in a situation where i am redirecting user to another page with following jQuery code

window.location = "/#/customer/email?isEmail=true&eid=1&template=2";

i have some url re-writing , and so complete url becomes is

https://demo.qa.com/#/customer/email?isEmail=true&eid=1&template=2

but in PHP when i try to get full page url using this

echo $_SERVER['REQUEST_URI'];

it just gives me this

/

i just want to get variable IsEmail

$_GET['IsEmail']

value in PHP page,

I think the

#

in between the URL is creating the problem, is there any way to get it, please advise..

Upvotes: 0

Views: 92

Answers (2)

Brad
Brad

Reputation: 163272

The anchor fragment portion of the URL (anything after #) isn't sent to the server at all. It only lives client-side. The server has no knowledge of it, and therefore PHP has no knowledge of it.

If you want to do anything with the anchor fragment, you must do it client-side.

Upvotes: 1

Ja͢ck
Ja͢ck

Reputation: 173522

The fragment is never sent to the server, so if you want access to the query parameters you need to bring them forward:

https://demo.qa.com/?isEmail=true&eid=1&template=2#/customer/email
                    ^                             ^
                    query                         fragment

Upvotes: 5

Related Questions