tags:

views:

79

answers:

3

Hi!

How can I print an $_POST ?

Example: echo $_POST['data'];

This returns nothing...

+1  A: 

Your code is correct.

You can use either:

var_dump($_POST);

or

print_r($_POST);

to print out the entire POST array for debugging.

Tim Ridgely
+1  A: 

You can only show the values of keys that exist. array_keys() returns an array containing the keys that exist in the array. If there is no output for a key despite the fact that the key exists then the array may contain an empty value for that key.

Ignacio Vazquez-Abrams
Could you write an example?
Victor
... Could I write an example of how to call a function? Is that what you're asking?
Ignacio Vazquez-Abrams
+1  A: 

you can also wrap your code with <pre> tags to make your array prints out nicer instead of just 1 continuous line. A trick that was shown by a member on this site.

<pre>
var_dump($_POST);
</pre>
Jamex
Thank you, worked out perfectly :)
Victor