post method does not work on server

I have a simple form in index.php:

<form action="extern.php" method="post">
    <input type="text" name="name" value=""><br>
    <input type="submit" value="send">
</form>

In extern.php I receive the form and echo

<?php
$text = $_POST['name'];
echo $text;
?>

I want to send the field name to extern.php, and echo it. I receive it in local, with Mamp. If I upload the files to the server extern.php does not receive it. It gives me the error:

Notice: Undefined index: name

Is that code correct to send a form with post and php? if so, why it does not work on the server?

print_r($_POST);

Sponsor our Newsletter | Privacy Policy | Terms of Service