-2

I simply cannot get the $_POST method to work. Instead $_GET contains the data

I used Postman to test via POST and GET method: Screenshot

Server PHP Settings

Request: ***.rising-games.net/posttest.php?test=Something

<?php
echo "Request method: " . $_SERVER['REQUEST_METHOD'] . "<br><br>";

//-------------------------------------------
//  POST output
//-------------------------------------------
if (isset ($_POST ["test"]))
    echo "Post 'Test' is: " . $_POST ['test'] . "<br>";
else
    echo "Post 'test' is empty!<br>";

//-------------------------------------------
//  Get output
//-------------------------------------------
if (isset ($_GET ["test"]))
    echo "Get 'Test' is: " . $_GET ['test'] . "<br>";
else
    echo "Get 'test' is empty!<br>";

//-------------------------------------------
//  Request output
//-------------------------------------------
if (isset ($_REQUEST ["test"]))
    echo "Request 'Test' is: " . $_REQUEST ['test'];
else
    echo "Request 'test' is empty!";

?>

Rhutos
  • 11
  • 3
  • possible duplicate of [PHP: Notice: Undefined variable and Notice: Undefined index](http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index) – Funk Forty Niner Mar 06 '16 at 15:03

1 Answers1

0

You try to use post request. But you set value of test parameter not to message body of request but to get parameter http://www.rising-games.net/posttest.php?test=Something

Try this in Postman: enter image description here

alexander.polomodov
  • 5,396
  • 14
  • 39
  • 46