Re: $HTTP_POST_VARS confusion

From: Date: Thu, 05 Oct 2000 00:59:38 +0000
Subject: Re: $HTTP_POST_VARS confusion
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-18688@lists.php.net to get a copy of this message
Thank you, Joe! I defined the form fields as constants and it works beautifully. Erica At 05:23 PM 10/4/2000 -0700, Joe Stump wrote:
You could always put all of your vars in an array in the form - like this: <INPUT TYPE="text" NAME="f[username]" VALUE="<? echo $f['username']; ?>"> pass it to the function like this: process_form($f); Another *possible* solution would be to put this at the top: while(list($key,$val) = each($HTTP_POST_VARS)){
    define("$key","$val");
} That should work :O) --Joe On Wed, Oct 04, 2000 at 04:31:08PM -0700, Erica Douglass wrote: Hello! I have a question about the variables posted in a form. Supposedly, register_globals in the PHP config file enables you to simply use a variable/value pair that was included in a posted form (such as $username.) However, I am using a function to process my form, and I can't seem to get the function to do this without adding a global declaration at the beginning of the function, such as global $username. This quickly becomes a pain as well as being non-extensible. I made sure register_globals was turned on, and I even added $HTTP_POST_VARS to the global declaration, but I have had no success. What is the right solution to this problem? (Note: I tried to figure out a workaround using the array generated by $HTTP_POST_VARS, but it didn't work. Perhaps someone has a suggestion as to how to declare variables by cycling through an array?) Erica


« previous php.general (#18688) next »