Click here to get back home

$_POST case sensitivity

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
$_POST case sensitivity Bill H 07-05-2008
Posted by Bill H on July 5, 2008, 4:35 pm
Please log in for more thread options
I wouldn't consider myself a newbie to PHP since I have never written
one line of code in it (am a perl guy myself), but part of a team I am
working with is writing some php interfaces into a database and I
noticed that they are relaying on HTML form value names to always be
lowercase in their code (ie $_POST['save'] (fyi that may be typed
wrong)) and from my experience it is always better, when reading in
the post information to convert the the form value name to uppercase
on the off chance that one web page may have NAME="save" and another
may have NAME="Save", this way you can will always get the value.

In perl this is easy cause you are pulling in the name / value pairs
straight from the ENV value. But since, from what I see and they say,
PHP does this for you and puts it into $_POST, is there a way to tell
PHP to always convert the name of the value to uppercase?

Bill H

Posted by Paul Lautman on July 5, 2008, 4:57 pm
Please log in for more thread options
Bill H wrote:
>I wouldn't consider myself a newbie to PHP since I have never written
> one line of code in it (am a perl guy myself), but part of a team I am
> working with is writing some php interfaces into a database and I
> noticed that they are relaying on HTML form value names to always be
> lowercase in their code (ie $_POST['save'] (fyi that may be typed
> wrong)) and from my experience it is always better, when reading in
> the post information to convert the the form value name to uppercase
> on the off chance that one web page may have NAME="save" and another
> may have NAME="Save", this way you can will always get the value.
In my experience php scripts are written to interact with specific web
pages. You code the web page to match the script that will process its
input.



Posted by macca on July 5, 2008, 8:51 pm
Please log in for more thread options
$_POST is just another array

foreach ($_POST as $key=>$value){

strtoupper($key);

}

Posted by Paul Lautman on July 6, 2008, 5:50 pm
Please log in for more thread options
macca wrote:
> $_POST is just another array
>
> foreach ($_POST as $key=>$value){
>
> strtoupper($key);
>
> }

I KNOW that! What the !¬"!££$£$ are you telling me for?

Learn how to post replies!



Posted by macca on July 6, 2008, 9:13 pm
Please log in for more thread options

> That the best you can do? =A0

What's it got to do with you?

When someone insults you for a simple mistake, when your intentions
are good and you are trying to help someone it's not good netiquette
and doesn't deserve more than about 3 seconds of my time, if that.

>Please learn how to reply properly.

is a more reasonable response.

Similar ThreadsPosted
Case Sensitive, Case Sensitivity, $_GET March 5, 2006, 3:27 pm
Case sensitivity in programming languages. July 25, 2006, 6:03 pm
PHP Post, then HTML Post? November 24, 2004, 5:54 pm
In case you need it.... March 29, 2007, 7:34 pm
$_GET and case. February 2, 2005, 5:37 pm
case syntax May 19, 2005, 9:30 am
case sensitiviness November 15, 2006, 5:53 am
Pls help a greenhorn with not case sensitive October 5, 2004, 3:48 am
php: case-INsensitive variables? February 17, 2005, 12:58 pm
File Name case check July 12, 2005, 7:57 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap