Jump to content

Url?=Value


eTianbun

Recommended Posts

it pass the key value pair to page.php as GET method.itlooks like

http://doma.in/dir/page.php?var=2265

so in page.php $_GET['var'] will hold 2265

Link to comment
Share on other sites

The question mark and the equal sign is used to pass variables from the URL. Let's say we have this url

http://www.sampleurl.com/index.php?name=john

name=john is a pair of variable-value. The variable $name has the value of john. In order to get the value of the variable you have to use the $_GET variable like this

$_GET['name']

Link to comment
Share on other sites

Thanks, but i will be glad if you explain more on it.
Everything after "?" is pairs of name and a value. The "=" separates the name and value, and "&" can be used to pass several pairs. It's possible to have an empty string as a name, so
page.php?=2265

means that within the page.php file, $_GET[''] will hold the value 2265.The URL could also look like (for example)

page.php?=2265&lang=en

in which case, page.php will be able to use $_GET['lang'] to get the value "en".The purpose of query strings is to let a single PHP file deal with multiple inputs. The same "program" that gets executed for

page.php?=2265

also gets executed for

page.php?=1

except that the value of $_GET[''] that page.php will work with is "1", which would supposedly end up displaying something different on screen.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...