|
Posted by Carl on 09/29/82 11:36
Isaac Hunt wrote:
> Hi
>
> I'm trying to get variables POSTed from a form. What I'm looking for is a
> way of getting all variables in one shot. The form contains (amongst other
> things) the following lines:-
>
> <input type="hidden" name="action" value="checknew">
> <input size="50" name="emai1" value="<? echo $email; ?>">
>
> I'm trying to read them back in using:-
>
> foreach($_POST as $key => $value)
> {
> # $this->$key = $value;
> echo "$key = $value<br>\n";
> }
>
> This is showing all the vaiables without a problem but if I put the
> following straight after I get nothing
>
> echo " ACTION = ".$action;
>
> Adding a $action=$_POST[action];
> works fine.
> Is there a simple way to get all the variables without doing a $_POST[] for
> each one? That's a bit long winded if there's 80 plus to read in.
> register_globals is off.
>
>
Isaac,
Yes, but it it not recommended. If you are really sure you want to do
this, i'll give you a hint; you want to 'extract' the values of the post
array. If you go this route, please make sure you have read and
understood the warning(s) in the function documentation and followed the
recommended precautions.
In reality though this is generally not a good idea, and almost as bad
as setting on register globals.
Carl.
Navigation:
[Reply to this message]
|