1

Hi i have a problem with $_POST Method.

this is my code :

<form method="post" action="index.php">
  <input type="text"name="tb"/>
  <input type="submit" value="Send"/>
</form>

<?php
  echo $_POST['tb'];
?>

and this is error message:

Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0 Warning: Cannot modify header information - headers already sent in Unknown on line 0

i used PhpStorm Editor And php-7.0.3-nts-Win32-VC14-x86. i try to change my php.ini but it's not work.

santosh
  • 799
  • 5
  • 17
kkaka
  • 29
  • 5

4 Answers4

1

Try this

<form method="post" action="">
 <input type="text" name="tb"/>
 <input type="submit" value="Send"/>
</form>

add space in type="text"name="tb"
and see this
warning-about-http-raw-post-data-being-deprecated
after change php.ini restart webservice

Community
  • 1
  • 1
paranoid
  • 6,799
  • 19
  • 49
  • 86
1
  1. You forgot to give Space.
  2. Also check variable existence.

      <form method="post" action="index.php">
      <input type="text" name="tb"/>
      <input type="submit" value="Send"/>
    </form>
    
     <?php
     echo $tb = isset($_POST['tb']) ? $_POST['tb']  : "";
      ?>
    
Niklesh Raut
  • 34,013
  • 16
  • 75
  • 109
  • $_get method it's working well but $_POST not working. i can't Understand This Error message :Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0 Warning: Cannot modify header information - headers already sent in Unknown on line 0 – kkaka Feb 14 '16 at 08:58
  • @kkaka Did you tried to replace all code with my given ans? In index.php – Niklesh Raut Feb 14 '16 at 09:03
  • Set always_populate_raw_post_data =-1 in your php.ini and then try – Niklesh Raut Feb 14 '16 at 09:12
  • yes i did but still i receive that message :-( "always_populate_raw_post_data" it's not exist on php 7 – kkaka Feb 14 '16 at 09:31
  • http://stackoverflow.com/questions/26261001/warning-about-http-raw-post-data-being-deprecated – Niklesh Raut Feb 14 '16 at 09:47
0
<form method="post" action="index.php">
  <input type="text" name="tb"/>
  <input type="submit" value="Send"/>
</form>

<?php
  echo $_POST['tb'];
?

add space between HTML Tag attributes

Bishoy Bisahi
  • 377
  • 1
  • 11
0

go to settings > Build, Execution, Deployment > Deployment:

  • add a local or mounted folder
  • use the root folder
  • under 'Mappings' complete the deployment path (i.e http://localhost/root folder
  • and the web path (i.e /root folder

works fine here

dlao
  • 11
  • 1