I have a php file like this
<?php
header('Content-type: application/json');
echo $_POST['name'];
?>
then I do a post request using postman,
The actual error is Undefined index: name
I have a php file like this
<?php
header('Content-type: application/json');
echo $_POST['name'];
?>
then I do a post request using postman,
The actual error is Undefined index: name
Just try like this: Select 'form-data' radio button under body near the 'x-www-form-urlencode' and try again.
You have set the Content-type to json, so you should return json response. change the statement from $_POST['name'] to json_encode($_POST['name']);