Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Member Tevek's Avatar
    Join Date
    Aug 2004
    Location
    UK
    Posts
    32
    Member #
    7215
    Sorry, probably an easy question but is there any way to get all the POST values that are sent to a page?

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Okay. One way is to have a hidden button called required with the names of the fields you want to get, such as

    PHP Code:
     <input type="hidden" name="required" value="name,email,message"
    Then, we loop for the name of the hidden button, like so

    PHP Code:
    $required_fields explode(","$_POST['required']); 
    Then, those values will be stored in the array $required

    From there do what you wish.

  4. #3
    Senior Member Fallout's Avatar
    Join Date
    Aug 2003
    Location
    Richmond, Virginia
    Posts
    543
    Member #
    2748
    Put this on the page and it will print out all the POST vars. If you want to do something else with them, I assume you know enough PHP to manipulate them.

    PHP Code:
    <?php 

    print "POSTed Variables:<br />\n";

    foreach (
    $_POST as $key => $post) {
        print 
    "<b>" $key "</b> = " $_POST[$key] . "<br />\n";
    }

    ?>

  5. #4
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    A variation of the above (and straight from the manual), which examplifies the combined use of list and each:
    PHP Code:
    reset ($_POST);
        while(list(
    $key,$val) = each($_POST))
            print 
    $key." = ".$val."<br>"
    If you want to make all POST-variables available globally within the recieving script
    (meaning you can call $name directly instead of assigning it like $name=$_POST['name']),
    you can use import_request_variables( "P")

    [PHPfunction]import_request_variables[/PHPfunction]
    S. Rosland

  6. #5
    Member Tevek's Avatar
    Join Date
    Aug 2004
    Location
    UK
    Posts
    32
    Member #
    7215
    Ahh that's perfect, thanks a lot guys!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:43 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com