How to print out $_REQUEST varilables from a server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hassnajib
    New Member
    • Jun 2008
    • 1

    How to print out $_REQUEST varilables from a server

    I am having problem retrieving $_REQUEST array key/value i submintted using post method. here is the simple form I am posting:
    [code=html]
    <html>
    <head>
    </head>
    <body>

    <form action="http://192.168.130.51: 8080/merchantAPI/postPairs" method="post">
    Request Type: <input type="text" name="reqType" value="CCSale"/><br />
    Merchant ID: <input type="text" name="merchantI D" value="12"/><br />
    Merchant Key: <input type="text" name="merchantK ey" value="key"/><br />
    Refrence Num: <input type="text" name="reference Num" value="1"/><br />
    Total Amount: <input type="text" name="chargeTot al" value="1"/><br />
    Credit Card#: <input type="text" name="creditCar dNumber" value="37323538 7881007"/><br />
    Exp Month: <input type="text" name="creditCar dExpMonth" value="12"/><br />
    Exp Year: <input type="text" name="creditCar dExpYear" value="2008"/><br />
    <input type="submit" name="submit" value="Submit" >
    </form>
    </body>
    </html>
    [/code]
    After submitting the form I want to view/print the response from the server using a simple code such as:
    [code=php]
    foreach($_REQUE ST as $key=>$value)
    echo("<tr><td>$ key</td><td>$value</td></tr>");
    [/code]
    how can i do this. can anyone please help
    Last edited by Atli; Jun 23 '08, 07:29 PM. Reason: Added [code] tags.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi. Welcome to Bytes!

    The code you posted should work fine.
    You just have to create a PHP file, containing the PHP code you posted, and have the action parameter of the <form> element point to that PHP file.

    Comment

    • nashruddin
      New Member
      • Jun 2008
      • 25

      #3
      You mean you want to debug the variables from your PHP script?

      Code:
      <?php
      print '<pre>';
      print_r($_REQUEST);
      print '</pre>';
      ?>

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        I like the compact version :)
        [code=php]
        echo "<pre>", print_r($_REQUE ST, true), "</pre>";
        [/code]

        Comment

        Working...