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

    Join Date
    Aug 2000
    Location
    Seattle, Wa USA
    Posts
    3
    Rep Power
    0
    Hi everyone!

    I am trying to debug various scripts and am wanting to print all my available variables to a page. I'd like to print :

    $name = value

    so

    $name = anne
    $email = anne@anne.com

    etc. All available variables and the related value, all print on the screen. How do I do this? Even printing environment variables is fine, the more the better I guess. I tried printing $HTTP_POST_VARS but to no avail.

    Thanks again,

    Anne :-)

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

    Join Date
    Mar 2000
    Location
    Ontario, Canada
    Posts
    498
    Rep Power
    18
    1) $HTTP_POST_VARS is an array, and if you have TRACK_VARS on this array is quite usless as PHP automatically follows the keys and values in the POST string.

    2) To print out both the variable's name and it's contents, escape the string symbol ($) when printing the variable
    eg; print "$name = $name";

    Hope those tidbits of information help.

    ------------------
    To alcohol! The cause of, and solution to, all of life's problems. -- Homer Simpson
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    24
    Rep Power
    0
    You can put this code at the begining of the file you are submitting your form to ...

    Cheers !!

    <?
    if ($HTTP_GET_VARS){
    while (list($key, $value)= each ($HTTP_GET_VARS)){
    echo "$key = $value<BR>";
    }
    }

    if ($HTTP_POST_VARS){
    while (list($key, $value)= each ($HTTP_POST_VARS)){
    echo "$key = $value<BR>";
    }
    }
    ?>



    [This message has been edited by anand (edited August 31, 2000).]
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Seattle, Wa USA
    Posts
    3
    Rep Power
    0
    Thanks friends!

    TRACK_VARS I believe is off, and the array isn't printing cgi environment variables such as $HTTP_AGENT ... and the rest. I want it all baby, everything available in the headers to print!

    Am running in PHP safe mode as well.

Similar Threads

  1. Passing POST variables
    By rlorenzo in forum PHP Development
    Replies: 11
    Last Post: June 6th, 2004, 02:00 PM
  2. help with assigning variables, variable passing/ retrieval
    By pinkipodmini in forum PHP Development
    Replies: 0
    Last Post: February 13th, 2004, 09:40 PM
  3. Replies: 2
    Last Post: February 10th, 2004, 11:03 PM
  4. functions and variables
    By uniopp in forum PHP Development
    Replies: 7
    Last Post: September 25th, 2003, 09:43 AM
  5. Automatically creating class variables
    By dreamstring in forum PHP Development
    Replies: 1
    Last Post: August 15th, 2003, 09:12 AM

IMN logo majestic logo threadwatch logo seochat tools logo