Re: detecting POST variables

From: Date: Tue, 08 Oct 2002 00:12:06 +0000
Subject: Re: detecting POST variables
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-119168@lists.php.net to get a copy of this message
This is a snippet of what I use: <code> foreach ($HTTP_POST_VARS as $Index=>$Value) { echo "DEBUG ::: POST Key: $Index; POST Value: $Value<br>\n"; } </code> But I just want to know why sometimes when the form has empty values, that sometimes it prints the key's name but not the actual value. Assume the form has a textbox with name="FirstName", sometimes I get DEBUG ::: POST Key: FirstName; POST Value: OR empty string ### it looks like the first case has FirstName as a key in the POST array, where as the latter doesn't. <nicos@php.net> wrote in message news:20021007235016.66479.qmail@pb1.pair.com... > You should use > foreach($_POST as $key => $value) { > echo $key.':'.$value; > } > Btw thats just an example to get all $_POST values, all superglobals are > arrays. > > -- > > Nicos - CHAILLAN Nicolas > nicos@php.net > www.WorldAKT.com - Hébergement de sites Internet > > "Anup" <anup_patel@rogers.com> a écrit dans le message de news: > 20021007230927.42240.qmail@pb1.pair.com... > > Hello, I have been dealing with different form proccessing PHP scripts. > When > > I start a new job I usually have a script that just takes the form POST > > values and prints them to the screen, so I know what I'm working with. > Now > > I have a question say the form has 1 field named "FirstName". If the field > > is left blank, sometimes my script will print the key and NO value, or it > > will just print out nothing, ie NO key or value. > > > > any ideas. Could it be the server (IIS or Unix/Linux) of the form and the > > server (IIS or Unix/Linux) of the script.? > > Since I do jobs for different people and environments any combination of > > servers are possible. > > > > The reason, for this post is that I don't know if I should always put code > > to check for validilty using isset all the time or should I put it in just > > in case the script gets moved. I want to pinpoint this so that I can write > > more effective code. > > > > > > > > > >

« previous php.general (#119168) next »