I created this piece of code as part of a practise exercise, however it is not working as intended, I pinpointed the issue to the PHP code losing the values I input via text box
It should be if(!empty($_POST...
everywhere.
The exclamation mark is missing, which would mean that he would only get data if the field were empty, as per the comment above "why are you sanitizing empty data?" from @chris85. Hence everything should have if(!empty...
except for
if (empty($_POST["name"])) {
if (empty($_POST["customeremail"])){