Fang Fang - 4 months ago 41
PHP Question

GET works but POST doesn't

I have a simple HTML form:

<form class="form-signin" action="formHandler.php" method="post">
<h2 class="form-signin-heading">Login</h2>
<label for="inputUsername" class="sr-only">Benutzername</label>
<input type="inputUsername" name="inputUsername" id="inputUsername" class="form-control" placeholder="Username" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" name="inputPassword" id="inputPassword" class="form-control" placeholder="Password" required>
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
<button class="btn btn-lg btn-primary btn-block" type="clear">Clear</button>

which I send to the following PHP script:


When I use GET, my variables get passed correctly. However, when I use post (as in the example) var_dump($_POST) returns an empty array.


After extensive searching, I found out that the issue is rooted in PHPStorm's local environment. The POST request works fine when the site is deployed to a local Apache environment or when uploaded to a website.

The problem is documented on IntelliJ website:

POST Problem with PHPStorm 10.02 and onwards

Jetbrains issuetracker with the issue in question: