LuisE LuisE - 1 year ago 97
PHP Question

$_POST is empty when using Postman but not when submiting forms

I want to use $_POST to send info from an App to a server, but when I test with Postman the $_POST doesn't get set. I am using XAMPP and php 5.6.23:

if (isset($_POST["test"])){
echo $mystring;
else {
echo "it is not even set";

This, when set with Postman, will respond:

"It is not even set"

However, when sent with this:

<form method="post" action="http://localhost/quetzal/test.php">
<input type="text" name="test" value="it is set!" />
<input type="submit" value="CHECK MY CODE" /> </form>

It will give a satisfactory output:

it is set!

I've already set this in my php.ini:


It is kinda driving me nuts...

Edit: Screens of postman usage
Postman submit 1

and Get superglobal is working fine(just replacing POST for GET (however I need to use POST in volley request, unless I use a workaround, but that is not clean):
I just change POST for GET

Answer Source

You are actually sending the test as a query parameter (retrievable within your php script via $_GET['test']. To add POST data in Postman, click on the Body tab and add the data there.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download