Re: Newbie, Post/Get error
| From: | Andy Hoffman | Date: | Wed, 11 Oct 2000 14:29:19 +0000 |
| Subject: | Re: Newbie, Post/Get error | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3155@lists.php.net to get a copy of this message | ||
Daniel Schwab wrote:
> in PHP-File
> array_walk($HTTP_POST_VARS, print_array) ;
> echo "$MyTextBoxName";
>
> The values _are_ in the Array $HTTP_POST_VARS but there's
> _nothing_ in $MyTextBoxName.
First, do you have a function defined in your script called "print_array"?
"array_walk()" is trying to apply every element of the POST_VARS array to a
specific user-defined function... Depending on how complicated the form you
are trying to process is, here's what I recommend...
For a simple (no more than 20 form elements) I suggest setting
"register_globals = on" in you php.ini, and then you AUTOMATICALLY have
access to the simple variables named to match your form elements... like
this
from html:
<input type="text" name="txtTextBox">
then in php script (processing that form), the above data would be available
as $txtTextBox.
Of course, with "track_vars = on" in your php.ini, you can also easily get
at the form variable like this:
$HTTP_POST_VARS['txtTextBox']
So, for not-so-complex forms, I recommend using either of the above
techniques and staying away from the intricacies of something like
"array_walk()".
--
Andy Hoffman
Web Developer
Bristol-Myers Squibb
email: andy.hoffman@bms.com