I am trying to create a contact form that sends a e-mail to a specified e-mail account. Thus far I have been able to send an e-mail through the form. For security reasons and also to filter out rubbish, the data needs to be validated before sending the e-mail.
After a user submits the a form the data needs to be validated and if filled out correctly an e-mail is send. If not the user needs to stay on the same page with a warning that the data is missing or not correct.
To accomplish this I want to use the $PHP_SELF action. However, for the layout my site uses templates that are included through an include_once function. At first I want to use an IF / ElSE statement in combination with to inject the template with HEREDOC. However, with HEREDOC I haven't been able to use my include files.
Could someone offer me general advice how to accomplish this?