Thread: $HTTP_POST_VARS

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    7
    Rep Power
    0
    When information is returned from a form, it can be extracted from global variables quite easily.

    However, it appears to be better to use $HTTP_POST_VARS for this. After all, this is what it was designed for.

    My problem is that if values from several checkboxs are returned in an array, eg $check[], all I can get from $HTTP_POST_VARS is a variable 'check' containing the value 'Array'.

    How can I extract the values from the 'check' array?

    Mike Saapsard
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 1999
    Posts
    114
    Rep Power
    16
    Individual items can be accessed like this:

    $check[0]
    $check[1]
    etc.

    You can loop through all like this:

    while (list ($iKey, $sVal) = each ($check)) {
      // $iKey holds the indices
      // $sVal holds the values
    }
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    7
    Rep Power
    0
    Thanks, I had problems getting data out of multi-dimensional arrays.

    I eventually cracked it, with a recursive routine - my original logic was a bit dodgy! I posted the script as ReadArrays.php under forms scripts.

    Mike Sapsard

IMN logo majestic logo threadwatch logo seochat tools logo