| | |
Where _GET[] array is formed?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Sep 2008
Posts: 25
Reputation:
Solved Threads: 1
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.
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.
•
•
•
•
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
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:
http://www.daniwebs.com/forums/newreply.php?do=postreply&t=14773
Then to get the variable 'do' you would use the following code to print/echo/display it to the browser:
php Syntax (Toggle Plain Text)
<? echo $_GET['do']; ?> Above produces below postreply
php Syntax (Toggle Plain Text)
<? echo $_GET['t']; ?> above produces below: 14773
As for the default value, there is no default value as it only holds the values that are in the url bar.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
use this:
PHP Syntax (Toggle Plain Text)
if(empty($_GET)) { //code }
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
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['a'] or $_GET['myvariable'] 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).
Edit:
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:
The preg replace should be something along those lines.
"" - 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).
Edit:
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:
php Syntax (Toggle Plain Text)
$urlvars=preg_replace('/(.*)?(.*)/i',$2,$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); if ($urlvars='') { //code in here }
Last edited by cwarn23; Sep 26th, 2008 at 7:24 am. Reason: Added info
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
![]() |
Other Threads in the PHP Forum
- Previous Thread: How to return a php variable, to a html file which can be use in html file as javascr
- Next Thread: FTP URL Navigation
| Thread Tools | Search this Thread |
ajax apache api array basics beginner binary bounce broken cakephp checkbox class cms code codingproblem combobox cron curl database date display dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration interactive ip java javascript joomla js limit link login mail menu mlm mobile multiple mysql nodes oop outofmemmory paging parse paypal pdf php problem procedure query radio ram random recursion regex remote return script search server sessions smash sms soap source space sql syntax system table tutorial up-to-date update upload url validation validator variable video web webapplications websitecontactform xml youtube






