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..

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.