Here's the code
 foreach ($HTTP_POST_VARS  as $Index=>$Value) {
  echo "DEBUG ::: POST Key: $Index; POST Value: $Value<br>\n";
### Here's the function (this is how what I catually use).
function PrintVars () {
    foreach ($HTTP_POST_VARS  as $Index=>$Value) {
      echo "DEBUG ::: POST Key: $Index; POST Value: $Value<br>\n";

The first snippet seems to work fine by itself, but if call it as a function
(as the latter snippet) then it doesn't print the variables. I have the POST
array defined as global (in the function), could that be why it takes out
the empty textbox variables?

"Justin French" <[EMAIL PROTECTED]> wrote in message
> on 08/10/02 9:13 AM, Anup ([EMAIL PROTECTED]) wrote:
> > Hello, I have been dealing with different form proccessing PHP scripts.
> > 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.
> > I have a question say the form has 1 field named "FirstName". If the
> > is left blank, sometimes my script will print the key and NO value, or
> > will just print out nothing, ie NO key or value.
> Are you certain this is happening on text fields?  Typically text fields,
> password fields and textareas allways set a key, and no value of blank.
> $_POST['FirstName'] = '';
> Select boxes should always have a value set.
> Check boxes are only set IF the box was ticked.
> What I'd advise is that you make a quick form and test this out -- perhaps
> it was only checkboxes that were sometimes not being set?
> > any ideas.  Could it be the server (IIS or Unix/Linux) of the form and
> > server (IIS or Unix/Linux)  of the script.?
> > Since I do jobs for different people and environments any combination of
> > servers are possible.
> I've never experienced this problem on any environment -- FreeBSD, RedHat
> Windows.
> > The reason, for this post is that I don't know if I should always put
> > to check for validilty using isset all the time or should I put it in
> > in case the script gets moved. I want to pinpoint this so that I can
> > more effective code.
> You should be able to use isset() or empty() on text/password/textarea
> elements reliably.
> Write a SMALL test script, test it, and if it ain't working, post the code
> :)
> Justin

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to