How to read value from request query

I am very new php propgramming. But I have done classic asp.
I have a string request, eg

In my php page, I would like to read test value.
On my index.php, I have this code.

<? $y=$_GET["test"]; ?>

But I am getting error, Undefined index: test in index.php.
I can see, when I call index page first time, I call just as

Please can some help.

Many thanks.

If your php looks like “” then ‘test’ is not set so that is where you are getting the undefined index error message.
To solve this error from showing up when you first visit the page and no variable are sent use this

$y = $_GET[“test”];

Let us know if you have any other issues.

Sponsor our Newsletter | Privacy Policy | Terms of Service