Re: detecting POST variables

From: Date: Tue, 08 Oct 2002 14:22:02 +0000
Subject: Re: detecting POST variables
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-119262@lists.php.net to get a copy of this message
I've noticed that this issue is associated with text fields, password fields, and textarea fields. What about file fields? I have a form that is not showing the information pulled from a database in a file field. Any ideas why? Does the file type not allow this to be done? Jef +++++++++++++++++++++++++++++++++++++++++++= "Christian Haines" <christian@mitousa.com> wrote in message news:20021008011637.18571.qmail@pb1.pair.com... > maybe try... > > print "<pre>"; > print_r($HTTP_POST_VARS); > print "</pre>"; > > this will dump the entire post var array to the browser.. similar to > functions before but faster. > > ---- > > Christian Haines > Internet Developer > > MITOUSA. > Branding Strategies for Visual & Interactive Design > > 102 Tynte Street > North Adelaide SA 5006 > > e) christian@mitousa.com > t) 08 8361 9022 > f) 08 8361 9977 > w) www.mitousa.com > "Anup" <anup_patel@rogers.com> wrote in message > news:20021008003825.98333.qmail@pb1.pair.com... > > Here's the code > > <?php > > 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 () { > > global $HTTP_POST_VARS; > > 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" <justin@indent.com.au> wrote in message > > news:B9C86100.1349B%justin@indent.com.au... > > > on 08/10/02 9:13 AM, Anup (anup_patel@rogers.com) wrote: > > > > > > > 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. > > > > > > 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. > > Ie: > > > > > > $_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 > > the > > > > 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 > > or > > > Windows. > > > > > > > > > > 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. > > > > > > You should be able to use isset() or empty() on text/password/textarea > > form > > > elements reliably. > > > > > > Write a SMALL test script, test it, and if it ain't working, post the > code > > > :) > > > > > > > > > Justin > > > > > > > > >

« previous php.general (#119262) next »