Loop Through GET and POST Variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe This

    #1

    Loop Through GET and POST Variables

    Is there a way to loop through all GET and POST Variables? For
    instance; if I send 3 Get variables, but I do not want to know the
    names of each variable. I want to loop through and echo the name of
    the variable and the value.
  • Michael Fesser

    #2
    Re: Loop Through GET and POST Variables

    .oO(Joe This)
    [color=blue]
    >Is there a way to loop through all GET and POST Variables? For
    >instance; if I send 3 Get variables, but I do not want to know the
    >names of each variable. I want to loop through and echo the name of
    >the variable and the value.[/color]


    Return the current key and value pair from an array and advance the array cursor


    Micha

    Comment

    • Andy Hassall

      #3
      Re: Loop Through GET and POST Variables

      On 24 Nov 2004 14:23:37 -0800, joeandtel@gmail .com (Joe This) wrote:
      [color=blue]
      >Is there a way to loop through all GET and POST Variables? For
      >instance; if I send 3 Get variables, but I do not want to know the
      >names of each variable. I want to loop through and echo the name of
      >the variable and the value.[/color]

      Look up 'foreach' in the manual.

      --
      Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
      <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

      Comment

      • Chris Hope

        #4
        Re: Loop Through GET and POST Variables

        Joe This wrote:
        [color=blue]
        > Is there a way to loop through all GET and POST Variables? For
        > instance; if I send 3 Get variables, but I do not want to know the
        > names of each variable. I want to loop through and echo the name of
        > the variable and the value.[/color]

        foreach($_GET as $name => $value) {
        print "$name : $value<br>";
        }

        foreach($_POST as $name => $value) {
        print "$name : $value<br>";
        }

        and the same for $_COOKIE, $_REQUEST, $_SERVER etc etc and any other array
        you care to do it for as well.

        --
        Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/

        Comment

        Working...