468,249 Members | 1,470 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,249 developers. It's quick & easy.

Case Sensitive, Case Sensitivity, $_GET

IF, inside the address-bar, the link appears as:
index.php?CITY=Raleigh+NC
or
index.php?City=Raleigh+NC

$_GET['city'] displays behaves like a stubborn mule and refuses
to get the get and returns empty ("").

Is there a way to turn off the case sensitivity ?

Thanks.

Jim Carlock
Post replies to the group.
Mar 5 '06 #1
3 10092

Jim Carlock wrote:
IF, inside the address-bar, the link appears as:
index.php?CITY=Raleigh+NC
or
index.php?City=Raleigh+NC

$_GET['city'] displays behaves like a stubborn mule and refuses
to get the get and returns empty ("").

Is there a way to turn off the case sensitivity ?


foreach($_GET as $k => $v){
if (strtolower($k) == 'city'){
$myGetCity = $v;}
}

--
j

Mar 5 '06 #2
Jim Carlock wrote:
$_GET['city'] displays behaves like a stubborn mule and refuses
to get the get and returns empty ("").

Is there a way to turn off the case sensitivity ?


As an alternative to juglesh's suggestion, you could also change the case of
all keys of the $_GET array to lowercase using the array_change_key_case()
function:

$lc = array_change_key_case($_GET);
$city = $lc['city'];

Especially useful if there are more values to grab from the $_GET array.
JW
Mar 5 '06 #3
Jim Carlock asked:
$_GET['city'] displays behaves like a stubborn mule and refuses
to get the get and returns empty ("").

Is there a way to turn off the case sensitivity ?
"Janwillem Borleffs" <jw@jwscripts.com> suggested: As an alternative to juglesh's suggestion, you could also change
the case of all keys of the $_GET array to lowercase using the
array_change_key_case() function:

$lc = array_change_key_case($_GET);
$city = $lc['city'];

Especially useful if there are more values to grab from the
$_GET array.


Thanks, once again, Janwillem.

Going along and employing $lc, if I want to check and see if
anything exists inside the $lc array, what's the best way to do
this? Is there something that returns a TRUE or FALSE and
tells me $_GET holds stuff?

if (count($lc) != 0) {
// nothing set so show the full list
$ShowAllMenus = TRUE;
} else {
// something is set so start grabbing!
$LookAtGet = TRUE;
}

- OR -

if (isset($lc)) {
// something is set so start grabbing!
$LookAtGet = TRUE;
} else {
// nothing set so show the full list
$ShowAllMenus = TRUE;
}

- OR -

if ($lc == NULL) {
// nothing set so show the full list
$ShowAllMenus = TRUE;
} else {
// something is set so start grabbing!
$LookAtGet = TRUE;
}

Thanks, much.

Jim Carlock
Post replies to the group.
Mar 9 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

32 posts views Thread by Elliot Temple | last post: by
3 posts views Thread by adrian suri | last post: by
3 posts views Thread by Jason Tesser | last post: by
1 post views Thread by othellomy | last post: by
4 posts views Thread by julox | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.