Page 1 of 1

Passing parameter via url

Posted: Thu Oct 15, 2015 10:20 pm
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>";
?>

Re: Passing parameter via url

Posted: Thu Oct 15, 2015 10:25 pm
by Christopher

Code: Select all

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

Re: Passing parameter via url

Posted: Fri Oct 16, 2015 7:28 am
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.

Re: Passing parameter via url

Posted: Fri Oct 16, 2015 3:28 pm
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.

Re: Passing parameter via url

Posted: Fri Oct 16, 2015 3:37 pm
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

Re: Passing parameter via url

Posted: Fri Oct 16, 2015 3:44 pm
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\"

Re: Passing parameter via url

Posted: Sat Oct 17, 2015 12:22 pm
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().

Re: Passing parameter via url

Posted: Sun Oct 18, 2015 7:21 am
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