Angoose Angoose - 1 year ago 68
HTML Question

Can the GET variables be extracted?

I'm trying to store GET variables using PHP from this URL string, but doesn't seem to be working...


The PHP I tried is:

$email = htmlspecialchars($_GET["email"]);

and also...

$email = $_GET["email"];

Neither is working, Any ideas please? (BTW I have no means to change the URL string)

Answer Source

Follow this :

your url is : domain.local/welcome??fwd=cd&data={"email":""}

$fwd = $_GET['fwd']; //output cd
$data = json_decode($_GET['data']); //

echo $data->email; //output is

if your url like data={"email":"","name":"myname","mobile":123456"}

Then you can use bellow example :

echo $data->name; //output myname
echo $data->mobile; //output 123456
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download