So I made a custom form with functions to show an error message
if the mandatory input areas were left empty. But after the form is submitted once, it apparently retains the values in $_POST['name_of_element'] rendering the whole checking process useless.
I tried adding a session_destroy(); at submission but that leads to a php error claiming that no session was initiated.
Any help with this would be much appreciated. I just need the $_POST variables to be cleared when the functions have completed.