visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: PHP :: Where _GET[] array is formed?


By: mohammed2raja India  Date: 26/09/2008 11:59:48  English  Points: 20 Status: Answered
Quality : Excellent
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 ;

$nflag=$_GET['nflag'];

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.
By: VGR Date: 26/09/2008 20:05:19 English  Type : Comment
ok. The GET and POST superglobal arrays in PHP reflect (contain) the values send in the request to the web page. Am I clear ?

If the method is POST - this means usually a FORM method="post" - and the user clicks the type="submit" button (input), the data is transferred using the POST method to the receiver (next) page, defined in the FORM tag, ACTION attribute.
That "next" page then has all the data sent via POST in its $_POST array.

It's the same for the GET method, but this appears in the URI of the receiver script. This is the method for links (A HREF="something.php?var1=val1&var2=val2&...") and the receiver script (something.php in our case) the has the data sent available in the $_GET array.

you may mix GET and POST in a FORM by acting on the action attribute (GET) whilehaving a method="POST" on the FORM tag.

I don't like this, but you've also the $_REQUEST superglobal array which regroups all GET'ed and POST'ed values

so in your case : the echo line doesn't need the double quotes, the variable $nflag can be simply in the double-quoted string (will be evaluated by the interpreter). The $nflag variable has to pre-exist, so if it comes from a preceding page via the GET method, then you've to place the $nflag=$_GET['nflag']; sentence BEFORE the $nflag use. Take care nflag can be unset.

Alternatively, you can turn register_globals=on in php.ini, it'll save you trouble when passing homonymous variables between scripts with various methods (session variables, POST, GET) (be cautious, though)

It's the webserver which populated the $_GET and $_POST (and $_REQUEST) arrays.

I hope this helps
By: mohammed2raja Date: 27/09/2008 06:33:24 English  Type : Answer
Thanks VGR. I got it.
By: VGR Date: 27/09/2008 08:27:13 English  Type : Comment
cool 8-)

please close the Question then ;-) (button A or P on the right of the useful comments)
By: mohammed2raja Date: 27/09/2008 08:31:59 English  Type : Comment
Again thnx.

Do register to be able to answer

EContact
browser fav
page generated in 292.068960 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page