$_POST question

Discussion in 'PHP' started by patuljak, May 11, 2008.

  1. #1
    HI!

    Is there a way to get array indexes from $_POST.

    I need it because i would like to write php code which would echo

    Field name=Field value (for example name=$_POST["name"]

    but from any form submited (don't know indexes) to that php.

    THX very much
     
    patuljak, May 11, 2008 IP
  2. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #2
    jayshah, May 11, 2008 IP
  3. Alex Polski

    Alex Polski Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    http://www.php.net/array_keys
     
    Alex Polski, May 11, 2008 IP
  4. TeraTask

    TeraTask Peon

    Messages:
    37
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Wow. I'm shocked at the advice people give on here.

    
    if (is_array($_POST)) {
      foreach ($_POST as $key=>$value) {
        echo $key.'='.$value.'<br />';
      }
    }
    
    PHP:
     
    TeraTask, May 11, 2008 IP
  5. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #5
    Come again?

    My post actually recommended what you've written. :|
     
    jayshah, May 11, 2008 IP
  6. TeraTask

    TeraTask Peon

    Messages:
    37
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I have PM'd you regarding the nature of my comment.
     
    TeraTask, May 11, 2008 IP
  7. tomazinis

    tomazinis Peon

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    while (list($key, $val) = each($_POST)) {
    echo "$key => $val\n";
    }
     
    tomazinis, May 14, 2008 IP