Why is variable as $_POST empty, but $_GET works? [duplicate]

  php

$_POST does not longer work for me, but $_GET works fine.

I would like to find out why:

I have a script on my server (php 7.4) which worked fine all the time.

The php script is basically only this:

$myproductkey = $_POST["productkey"];
echo "Key: *" . $myproductkey . "*<br />";
Die;

When I call it like this….

https://mydomain.xyz/myscript.php?productkey=MyProductKeyABC

… the website displays:

Key: **

However, when I change the script like this:

$myproductkey = $_GET["productkey"];
echo "Key: *" . $myproductkey . "*<br />";
Die;

… it displays:

Key: *MyProductKeyABC*

Why does POST no longer work for me?
What could I have changed?

Source: Ask PHP

LEAVE A COMMENT