Jump to content

Passing Multiple Variable to the Address bar....


stevenryals

Recommended Posts

I'm trying to make a page with 2 forms..  both basically the same..

 

I have a URL:  http://website.com/variable1.variable2.variable3.variable4.etc.etc.etc

 

Lets say for instance, i'm searching on a website for an airfare.. 

Field 1: DEPARTURE AIRPORT

Field 2: ARRIVAL AIRPORT..

and so on..

 

I need to figure out how to put those variable into the URL that I have.. 

 

Any ideas?  this sounds simpler than i'm making it..

You need to use a query string, like:

 

website.com/index.php?departure=something&arrival=another

 

The query string is everything after the '?'.

 

In PHP, you grab the values using the $_GET superglobal array, like so:

$departure = $_GET['departure'];
$arrival = $_GET['arrival'];

echo "Your departure time is $departure, and your arrival time is $arrival";

 

That echo statement would output:

Your departure time is something, and your arrival time is another

 

If you used the query string I added to the fake URL I wrote above.

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.