Search code examples
formspostphpstorm

PHP7: Form Entries submitting with $_POST doesn't work - $_GET is ok


I am new to Stackoverflow, but I already have a simple problem where I need your help.

I have a simple form, where the user has to submit his first and last name:

<form action="u_eingabe.php" method="post"> <!--enctype="application/x-www-form-urlencoded"-->

<p>First name: <input name="firstname" id="vor"/></p>
<p>Last name: <input name="lastname" id="nach"/></p>
<p><input type="submit" /></p>

The u_eingabe.php contains the following simple code for getting the first and last name:

<?php echo "Ihre Adresse lautet:" . "<br />"; echo $_POST['firstname'] . " " . $_POST['lastname'] . "<br />"; ?>

On PHP5 there is no problem. It just transmits and displays the data. But on PHP 7.0.3 it doesn't show anything and throws the warnings, that the indexes are empty. (Notice: Undefined index: firstname)

The interesting thing is: if i switch to GET as method, everything is fine and it submits and displays the first and last name.

So has everything changed due to PHP7 for post method? Google didn't help out for this problem.


Solution

  • As i mentioned above, it works fine with php5. I didn't mention I use PHPStorm 10.0.3. I continued searching with google and found this: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206999125-PhPStorm-10-does-not-allow-POST-method

    It seems to be an issue in PHPStorm 10.0.2 and higher that POST-Requests are empty in the phpstorm built-in webserver.