Post方法在PHP中不起作用

I've tried some other posts, but never made it.

My php form inside html file is :

<form action="test.php" method="POST">
VAR:<input type="text" name="var"><br>
<input type="submit">
</form>

I'm receiving the variable in test.php as <br>

$_POST['var'] ---- > doesn't work! <br>

Tried, $_REQUEST['var'] ----> doesn't work!

I tried the form using get request, it works like a charm on the other end at test.php by using both $_GET['var'] and $_REQUEST['var'] Any way I can parse the request in the form of post request from that form to test.php ..

Appreciate the help! Thanks.

Updated to PHP 7.0 and it's working now!

Thanks everyone for their help!

Did you check the value of 'submit' whether it is set or not like

if(isset($_POST['submit'])){
$_POST['var']
}

Your html tag is wrong. You need to set name to it like this

<input type= "submit" name= "submit">

Then when you submit your form like this:

if(isset($_POST['submit'])) {
// you will set your post var, try to print it with
print_r($_POST);

}

And you don't need to add "/" to the input, it will work without it.

And sorry, ive made syntax mistake, forgot to close if statement. Now is correct.

Try this what is post on same page

<?php
if(isset($_POST['var_name'])) {
 print_r($_POST);
}
exit();
?>

<form action="" method="POST">
<input type="text" name="var_name"><br>
<input type="submit" name="Save">
</form>