Sometimes the content of the POST field disappears

Started by sanjana, Oct 18, 2022, 03:57 AM

Previous topic - Next topic

sanjanaTopic starter

Good afternoon, dear community users!
Sometimes, when passing a POST to a script, I catch a loss of content.
Here is a simplified text of the program.

$tab = 'sr';
include 'ent/enter.php';

enter.php :

  "<form class='form_enter' name='form1' method='post'
          action='../ent/do_enter.php' >
    echo  "<input name='tab' type='hidden'  value=".$tab.">
      <input id='w_h' name='w_h' type='hidden'  value=''>     
      <input type='submit' name='enter' id='enter' value=' Войти ' class='exit_but bg1'
      onclick='get_w_h()' style= 'width: fit-content;margin-left:10px;'></div>


if (!isset($_POST['tab'])){
   $smess = 'No tab-a! ';
   foreach($_POST as $key => $value){
     $smess .= ' '.$key.' - '.$value.', ';
   // Occasionally I find myself here. In this case, the entire $_POST is empty.

What could be the matter?
Thank you!


For example, a "third-party" GET request or a POST request with an empty body.
or the post key "rattles" and repeats sending data.
it would be good to block the post button on the onclick - disable button after the first sending of data .

Log more information. The request method, data $_POST, $_SERVER, $_SESSION, etc. Maybe it's some bot sending a form or a search robot coming in by direct link.
Close the file do_enter.php from the GET method returning a 405 error.
Judging by the code, since action leads to /ent/do_enter.php - I can assume that and /ent/enter.php you can open it by a direct link bypassing the main script.