Passing parameter via url

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yosmanor
Forum Newbie
Posts: 5
Joined: Thu Oct 15, 2015 9:48 pm

Passing parameter via url

Post by yosmanor »

Trying to pass parameter using this URL

http://premieraircharters.com/window.ph ... ice="$2300"

No values are transferred.

Any suggestions?

Code: Select all

<?php
$airport=$_get["airport"];
$state=$_get["state"];
$distance=$_get["distance"];
$price=$__get["price"];
Echo $airport;
Echo "<br>";
Echo $state;
Echo "<br>";
Echo $distance;
Echo "<br>";
Echo $price;
Echo "<br>";
?>
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Passing parameter via url

Post by Christopher »

Code: Select all

$airport=$_GET["airport"];
$state=$_GET["state"];
$distance=$_GET["distance"];
$price=$_GET["price"];
(#10850)
yosmanor
Forum Newbie
Posts: 5
Joined: Thu Oct 15, 2015 9:48 pm

Re: Passing parameter via url

Post by yosmanor »

Christopher wrote:

Code: Select all

$airport=$_GET["airport"];
$state=$_GET["state"];
$distance=$_GET["distance"];
$price=$_GET["price"];
hanks,

I am not sure what the syntax error is.
Pasted the above, same result.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Passing parameter via url

Post by pickle »

There is case sensitivity.

Code: Select all

$_get
is not a global variable.

Code: Select all

$_GET
is.

The quotes might be messing stuff up - try removing them.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
yosmanor
Forum Newbie
Posts: 5
Joined: Thu Oct 15, 2015 9:48 pm

Re: Passing parameter via url

Post by yosmanor »

pickle wrote:There is case sensitivity.

Code: Select all

$_get
is not a global variable.

Code: Select all

$_GET
is.

The quotes might be messing stuff up - try removing them.
Neither uppercase GET nor removing the quotes made a difference.

The values of the parameters are not transferred to the test php file
yosmanor
Forum Newbie
Posts: 5
Joined: Thu Oct 15, 2015 9:48 pm

Re: Passing parameter via url

Post by yosmanor »

yosmanor wrote:
pickle wrote:There is case sensitivity.

Code: Select all

$_get
is not a global variable.

Code: Select all

$_GET
is.

The quotes might be messing stuff up - try removing them.
Neither uppercase GET nor removing the quotes made a difference.

The values of the parameters are not transferred to the test php file

Thanks,
Part of the problem is solved.
Having said that the value appears with \" before and after it.
Any idea hoe to remove it


\"Bangor\"
\"Maine\"
\"180\"
\"$2300\"
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Passing parameter via url

Post by Christopher »

yosmanor wrote:
yosmanor wrote:Thanks,
Part of the problem is solved.
Having said that the value appears with \" before and after it.
Any idea hoe to remove it


\"Bangor\"
\"Maine\"
\"180\"
\"$2300\"
The best way would be to no put quotes around the values when you create the URL. Otherwise use trim(), substr(), str_replace() or preg_replace().
(#10850)
yosmanor
Forum Newbie
Posts: 5
Joined: Thu Oct 15, 2015 9:48 pm

Re: Passing parameter via url

Post by yosmanor »

Christopher wrote:
yosmanor wrote:
yosmanor wrote:Thanks,
Part of the problem is solved.
Having said that the value appears with \" before and after it.
Any idea hoe to remove it


\"Bangor\"
\"Maine\"
\"180\"
\"$2300\"
The best way would be to no put quotes around the values when you create the URL. Otherwise use trim(), substr(), str_replace() or preg_replace().

Thank you
Post Reply