I know this is a dumb question, but I can't figure out what this means. When I see .php?=. Also wondering how will go about using that.
Thanks for any help.
I know this is a dumb question, but I can't figure out what this means. When I see .php?=. Also wondering how will go about using that.
Thanks for any help.
It marks the start of a query string,which can be accessed with GET.
http://somesite.com/index.php?foo=1
$_GET['foo'] will be 1
The question mark is supposed to mark the start of the portion of a GET request where you can pass it variables (known as the query string). This is not just for PHP.
Example :
if you send the following :
to a php file that looks like this :
<?php
print($_GET["something"]);
print($_GET["another"]);
?>
the result will be this :
12blah
This is not
.php?=
There must be a variable name before =
.
Like this:
.php?x=
.
This is variable passed from URL to script. You can read this variable from PHP code like this:
$_GET['x']
More information here: http://php.net/manual/en/reserved.variables.get.php
suppose I have file1.php open and in it, I want to create a statement, which passes values to another page, file2.php. This is usually done through an html link or button. I will do it through a link in the below example.
In file1.php, I will include some code that does that:
<a href="edit.php?attribute=value> Link name</a>
This creates a "Link name" hyperlink that, when clicked, passes values by "GET" function into "edit.php".
I will catch the same in file2.php using the following statement in file2.php:
$variable=$_GET['attribute']
P.S. If you didn't understand anything, try forgetting every worry you have and now read the answer again.