The php script is running before the form has been submitted, so em has not been defined yet.
You need to add a test to see if the form has been submitted.
if($_SERVER['REQUEST_METHOD'] == 'POST') {}
There are other problems like
if(empty($email)){
Where has $email been defined?
The validation could also be put into an conditional too, so the script only completes if the email is valid.
$ema was probably $email. So I would assume it was declared, but OP probably had that as a typo. Nevertheless, empty and isset should never be used to check if the form was submitted. The only reason to use empty and isset is to determine if a user has been tampering with the HTML source code. If the HTML source has been tampered with, (e.g. Someone removing the actual field called tamper, that will cause a fatal error if you happen to try and sanitize that post value. This is because there isnāt such a field so PHP canāt process a field that was never declared.) That is the only reason to use empty and isset as they are not actual methods of checking whether the form was submitted or not as they are āhackedā quick ways of doing something and is widely taught in legacy code tutorials.