A quick workaround to check if the POST data is set:
<?php
$name = isset($_POST['name']) ? $_POST['name']: '';
$email = isset($_POST['email']) ? $_POST['email']:'';
$company = isset($_POST['company'])? $_POST['company']: '';
//In PHP 7 you can do this:
$name = $_POST['name']?? '';
$email = $_POST['email']?? '';
$company = $_POST['company']?? '';
You can then do the validation:
if(empty($name)){
echo 'Name is blank';
exit;
}elseif(empty($email) || !filter_var($email, FILTER_VALIDATE_EMAIL) === false){
echo 'Email is invalid';
exit;
}elseif(empty($company)){
echo 'Company is blank';
exit;
}else{
$name = filter_var ($_POST['name'], FILTER_SANITIZE_STRING);
$email = filter_var ($_POST['email'], FILTER_SANITIZE_EMAIL);
$company = filter_var ($_POST['company'], FILTER_SANITIZE_STRING);
$fp = fopen("Daten.txt", "a");
$savestring = $name . "\r\n" . $email . "\r\n" . $company . "\r\n" . "\r\n";
fwrite($fp, $savestring);
fclose($fp);
echo "Thank you ... please stand by ...
<meta http-equiv='Refresh' content='1; URL=.\play\index.html'>";
}
?>
Lastly I strongly recommend to check the type of filters here