Connecting Tech Pros Worldwide Help | Site Map

Case Sensitive, Case Sensitivity, $_GET

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 5th, 2006, 07:35 PM
Jim Carlock
Guest
 
Posts: n/a
Default 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.



  #2  
Old March 5th, 2006, 07:55 PM
juglesh
Guest
 
Posts: n/a
Default Re: Case Sensitive, Case Sensitivity, $_GET


Jim Carlock wrote:[color=blue]
> 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 ?[/color]

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

--
j

  #3  
Old March 5th, 2006, 08:35 PM
Janwillem Borleffs
Guest
 
Posts: n/a
Default Re: Case Sensitive, Case Sensitivity, $_GET

Jim Carlock wrote:[color=blue]
> $_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 ?
>[/color]

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


  #4  
Old March 9th, 2006, 07:25 PM
Jim Carlock
Guest
 
Posts: n/a
Default Re: Case Sensitive, Case Sensitivity, $_GET

Jim Carlock asked:[color=blue]
> $_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 ?
>[/color]


"Janwillem Borleffs" <jw@jwscripts.com> suggested:[color=blue]
> 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.[/color]

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.


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.