stevenryals Posted June 8, 2012 Share Posted June 8, 2012 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.. Quote Link to comment https://forums.phpfreaks.com/topic/263856-passing-multiple-variable-to-the-address-bar/ Share on other sites More sharing options...
KevinM1 Posted June 8, 2012 Share Posted June 8, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/263856-passing-multiple-variable-to-the-address-bar/#findComment-1352131 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.