I think you should need to check for isset and not empty value, like form was submitted without input data so isset will be true This will prevent you to have any error or notice.
if((isset($_POST['name'])) && !empty($_POST['name']))
{
$name = $_POST['name']; //note i used $_POST since you have a post form **method='post'**
echo $name;
}