As you know, $_POST exists.  You can also assign
groups of names to an array through your HTML form
like so:

  <input type="text" name="bar[name]">
  <input type="text" name="bar[doh]">
  ...

And then play with them, for example:

  extract($_POST['bar']);
  print "I say $name and $doh";

  extract($_POST['bar'], EXTR_PREFIX_ALL, 'bar');
  print "I say $bar_name and $bar_doh";

extract() is a pretty cool function with many
options, read about extract here:

  http://www.php.net/extract

And as already stated by others,
import_request_variables() and $_REQUEST exist too.

Regards,
Philip Olson




On Mon, 6 May 2002, 1LT John W. Holmes wrote:

> extract() wouldn't do you any good here, you'd still have to use echo $one,
> echo $two, etc...so what are you gaining?
> 
> If you just want the values displayed, use the foreach() method someone
> already posted. You can use implode() to combine the whole array in to a
> single string...if you need something more than that, let us know. With that
> many elements, maybe it's time to rethink your layout or naming conventions.
> 
> ---John Holmes...
> 
> ----- Original Message -----
> From: "David J Jackson" <[EMAIL PROTECTED]>
> To: "1LT John W. Holmes" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, May 06, 2002 3:07 PM
> Subject: Re: [PHP] Grabbing ALL $_POST var at once.
> 
> 
> > John ---
> > Thanks for your reply, but let me rephase the question.
> > Let say I have a form with 50 fields on it do I have to:
> >
> > echo $_POST['one']
> > ....
> > .....
> > .....
> > echo $POST['fifty']
> >
> >
> > Or should I, could I use extract()?
> >
> > Thanks in advance,
> > David
> >
> > p.s I said it was UGLY :)
> >
> >
> > > ?>
> > >
> > > If that's too hard to understand, use extract().
> > >
> > > ---John Holmes...
> > >
> >
> >
> >
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to