Why can't I send data with POST method?

There is a simple form with two fields. And there is a simple form of output from a simple condition. But the condition here is not important. The fact that I can't get to work the POST method. Here is the method get works. And POST no. Tell me what could be wrong. I checked three versions of PHP. Since finishing 5.4 7.0
Everywhere the same problem. I have php storm IDE on Windows 10, well apatch, everything seems to work, the other code works. But the POST method of data transmission no. Help solve the problem. A week I suffer with it.
Here is my example:

0cefdc6dd0f542c3954977b81c32d3b5.png

If you remove the condition it will be fot this message
Notice: Undefined index: personal in D:\www\Apache\web\test\index2.php on line 11
July 2nd 19 at 13:08
7 answers
July 2nd 19 at 13:10
$_POST always exists. Well, unless you do the unset hands will do.
So check for isset($_POST) doesn't make sense.
Yes, I already on everyone tried, without checking says Notice: Undefined index: name in D:\www\Apache\web\test\action.php on line 2, that can php.ini to include? - chelsie_Emmerich commented on July 2nd 19 at 13:13
Well, of course the use of external data without verification is E_NOTICE.

Before using external data, you must verify that this data is actually sent. - Ignacio_Romaguera commented on July 2nd 19 at 13:16
July 2nd 19 at 13:12
In your form, two of the same name. So it is impossible.
July 2nd 19 at 13:14
And, I forgot to take a lot of testing, trying to figure out why it is like this:
5f7a7d68fed04aa69fb98d0656a6b33b.png
what gives here

72433780620a48e4a14ad18c58c9982a.png

In any case, POST is not working. Tell you though I am doing the right thing, or now by Post as something different to pass the data you need?

var_dump($_POST); gives array(0) { }
July 2nd 19 at 13:16
what gives?
var_dump($_POST);
issued array(0) { } - chelsie_Emmerich commented on July 2nd 19 at 13:19
: change action to '/' - Ignacio_Romaguera commented on July 2nd 19 at 13:22
form action="/" - chelsie_Emmerich commented on July 2nd 19 at 13:25
He doesn't care, I'm already in one file it did and in a few, and even the html output via echo. All the same, the Global array POST stupid does not want to work. That's what gives if you do exactly as you say:
Notice: Undefined index: name in D:\www\Apache\web\test\index2.php on line 7 - mikayla_Kul commented on July 2nd 19 at 13:28
July 2nd 19 at 13:18
And You write:
var_dump($_POST);
issued array(0) { } - chelsie_Emmerich commented on July 2nd 19 at 13:21
in the form tag add the attribute enctype="application/x-www-form-urlencoded" - Ignacio_Romaguera commented on July 2nd 19 at 13:24
July 2nd 19 at 13:20
it says, checking isset( $_POST ) doesn't make sense. You need to check the specific key e.g. isset( $_POST['personal'] ). At the moment, your code works like a clock - the $_POST array exists, so is the first part of the condition. But at this point the index (array element) 'personal' yet, so PHP and swears at him - Undefined Index.
So all right, I tried that and this too. Still the same thing.
in the form write :
form action="action.php" method="POST"
and action.php write:
if(isset($_POST['name']) && isset($_POST['age'])) {
echo Hello '.$_POST['name'].' you.' $_POST['age'].' year';
}else{
echo ';
}
var_dump($_POST);
?>
and it gives
nothing array(0) { }
but if the condition is not to put it gives:
Notice: Undefined index: name in D:\www\Apache\web\test\action.php on line 2

Notice: Undefined index: age in D:\www\Apache\web\test\action.php on line 2 - chelsie_Emmerich commented on July 2nd 19 at 13:23
: Then check your PHP settings in the php.ini

track_vars (in older versions of PHP) = On
variables_order contains the letter P
post_max_size 8Mb and more

If you are using suhosin:

suhosin.post.max_vars
suhosin.request.max_vars

installed in a high enough value, such as 1000. - Ignacio_Romaguera commented on July 2nd 19 at 13:26
: And here try this trick:
$json = file_get_contents("php://input");
$_POST = json_decode($json, true);
and then try to work with $_POST - chelsie_Emmerich commented on July 2nd 19 at 13:29
July 2nd 19 at 13:22
For example, I have reproduced.

<?php

 if ($_SERVER['REQUEST_METHOD'] == 'POST') {

 $a = (isset($_POST['a'])) ? $_POST['a'] : 'a none';
 $b = (isset($_POST['b'])) ? $_POST['b'] : 'none b';

}

?>

 <form action method="POST">
 <input type="text" name="a">
 <input type="text" name="b">

 <p><input type="submit"></p>
</form>

<?= (isset($a)) ? $a : "; ?>
<?= (isset($b)) ? $b : "; ?>
I have your code produces a noneb none, he does not want to see the POST array? Windows 10 is blocking it? - chelsie_Emmerich commented on July 2nd 19 at 13:25
: check without any stupid forms an array of the post, it works at all?

$_POST['a'] = "test";
print_r($_POST['a']); - Ignacio_Romaguera commented on July 2nd 19 at 13:28
gave test, the course works! And why another does not work? - chelsie_Emmerich commented on July 2nd 19 at 13:31

Find more questions by tags PHPWeb Development