Passing Values In The Url With Php

Posted by in PHP, Programming

Here is simple php technique which will allow you to pass information between pages through the URL. The format used to pass variables in the URL is the url itself. Something like this:

www.domainname.com/index.php?variable_name1=the_value&variable_name2=the_value

Php Code is :

For example, if you load www.domainname.com/index.php , output will be

1. Variable Value:
2. Variable Value:

If you load www.domainname.com/index.php?variable_name1=2 , output will be

1. Variable Value: 2
2. Variable Value:

If you load www.domainname.com/index.php?variable_name1=2&variable_name2=5 , output will be

1. Variable Value: 2
2. Variable Value: 5

I hope you understand, this is only basic purpose of the $_GET Variable , there are many ways to use $_GET Variable.