FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!

Variables




Var are an important part of php, these are the ones that become "Dynamic" to php, variables can be obtained in different ways, in this case we see the GET method, then go over there with forms + POST For a variable using GET, you will need to have the following code file.php
Code:

$var = $_GET['varname'];
echo $var;

And the "URL" must have the following http://yourpage.domain/file.php?varname=foo
Where would the output of file.php "foo" to pass multiple variables can do this

Code:

$var = $ _GET ['varname'];
$othervar = $ _GET ['othervarname'];
echo $var."+".$othervar;

And the "URL" must have the following http://yourpage.domain/file.php?varname=foo&othervarname=otherfoo
Where would output 'foo+otherfoo"



4 blog comments below

just a word of advise: use _GET with caution
Marcuzzo on Thu Oct 03, 2013 11:42 pm
But, you can use request, that verify Get And Post,
Phpaddict on Fri Oct 04, 2013 2:32 am
I don't think $_GET is more dangerous than $_POST or any other input method. Never trust data that is sent from the user/browser and you'll be safe.
Peterssidan on Fri Oct 04, 2013 3:35 am
In other tutorial you can see the POST method...
Phpaddict on Sun Oct 06, 2013 8:37 pm



FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.