Friday 12th of March 2010

Passing Values In The Url With Php

April 27, 2009 by Ivan  
Filed under 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.



Best of PC Hacks

Related Posts



You can get our articles in your email inbox each day for free. Just enter your email below:

FeedBurner

Comments

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!