echo "<meta http-equiv=Refresh content=0;url=login.php?nflag=".$nflag.">";

Here i pass PHP variable nflag.
Can any body tell me where this variable(nflag) is store. So when i use
the statement ;


and get that value. Where the value of 'nflag is stored', ans from where _GET[] array is formed. What are the default value of _GET[] array? Please any body help me.

10 Years
Discussion Span
Last Post by mohammed2raja

So the line in the middle of the example above is basically telling the server to 'get' the variable 'nflag' from the url bar and to echo/display it.
From: http://www.daniweb.com/forums/thread147753.html

You may want to check the reply I made on your previous post.
The array $_GET[] basically just tells the server to get a variable from the url bar and the name of that variable goes between the two brackets. So say for example the address is as follows:
Then to get the variable 'do' you would use the following code to print/echo/display it to the browser:

<? echo $_GET['do']; ?>
Above produces below

or if you wanted to get the other variable in that address you would use

<? echo $_GET['t']; ?>
above produces below:

So the $_GET array and any other array beginning with $_ (dollar sign then underscore) is a inbuilt function.
As for the default value, there is no default value as it only holds the values that are in the url bar.

Votes + Comments
Good Reply...

Thanks cwarn23
But I hv a doubt. How can i check whether there are any value in url bar or empty. I mean how can i check there is a value in url or not. If there only address in url bar, then what is the value of _GET[]?


Well $_GET[] should always have quotation marks between the brackets and numbers/letters/characters between the quotation marks. So $_GET[] on its own isn't a valid command. You need something like $_GET or $_GET and if it does not exist in the url bar then it will return a string with 0 letters 0 numbers and 0 characters. So basically a $_GET statement which has letters between the brackets and quotation marks but those letters/variable does not exist in the url bar will return the below string if you remove the quotation marks:
"" - as you can see there is nothing between those quotation marks so you will just receive a blank string if it does not exist in the url bar.

So just a reminder, you always need something between those brackets (more than just quotation marks).

I just saw more of what you are asking for and to check if there is nothing there i prefer to use the preg replace function just like follows:

if ($urlvars='')
	//code in here

The preg replace should be something along those lines.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.