PHP $_POST not working?

This question already has answers here: PHP POST not working (10 answers) Closed 7 years ago.

I have the simplest form possible and all I want to do is echo whatever is written in text box.

HTML:

<form action="" method="post">
  <input type="text" name="firstname">
  <input type="submit" name="submit" value="Submit">
</form>

PHP:

if(isset($_POST['submit'])){
  $test = $_POST['firstname'];
  echo $test;
}

The problem is it’s not working on my server (it works on another server). Does anyone has an idea what could be wrong? There are other forms on the server and are working fine.

Leave a Comment