Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print out post values

Tags:

php

I have a form that has multiple fields, and for testing purposes is there a way I could print out the values entered in all the fields, without having to individually print each value.

like image 868
Brad Avatar asked Oct 13 '08 03:10

Brad


People also ask

How display all post values in PHP?

Simply: <? php print_r($_POST); //Or: foreach ($_POST as $key => $value) echo $key.

How do you print an array post?

To print POST data array: echo print_r($_POST,true); If you want better legibility within a browser, wrap in <pre> tags.

How do you print a form in Python?

Print FunctionThe Python print() function takes in any number of parameters, and prints them out on one line of text. The items are each converted to text form, separated by spaces, and there is a single '\n' at the end (the "newline" char).

What is $post in PHP?

PHP $_POST is a PHP super global variable which is used to collect form data after submitting an HTML form with method="post". $_POST is also widely used to pass variables. The example below shows a form with an input field and a submit button.


2 Answers

You should be able to do a var_dump($_REQUEST);

http://us2.php.net/manual/en/reserved.variables.request.php

http://us2.php.net/manual/en/function.var-dump.php

like image 153
defeated Avatar answered Oct 08 '22 23:10

defeated


For extra credit, I always have:

function pre($data) {
    print '<pre>' . print_r($data, true) . '</pre>';
}

Whenever I need to debug an array - which is very often - I just do pre($arr); to get a nicely formatted dump.

like image 32
Paolo Bergantino Avatar answered Oct 09 '22 00:10

Paolo Bergantino