I am trying to get the data in $_POST using code like this:
The main index.php
:
<form action="./action.php" method="post">
<input type="text" name="name" value="ok" />
<input type="submit" name="submit" value="submit" />
</form>
The action.php
inside the same folder of the index.php
:
<?php
echo $_SERVER['REQUEST_METHOD'];
echo $_POST['name'];
echo var_dump($_POST);
Once I launch the local host from phpStorm on index.php
. I click the submit button, the page will transform to action.php
as planned, and the new page displays: (I deleted the user path below.)
POST
( ! ) Notice: Undefined index: name in /action.php on line 3
action.php:4:
array (size=0)
empty
In the phpinfo()
, I have upload_max_filesize = 10M
and post_max_size=20M
, and enable_post_data_reading = On
.
I have searched multiple forums and end up with posting the question. Thank you for your help in advance.