I have one PHP file that takes data then displays it using the $_POST method. I know how to validate the inputs of the form using PHP:
if($data = "") {
echo "This Field Is Required";
}
But I don't know how to avoid the form submitting the data. Do I add a new line to this if statement? I saw something to do with header:locations in this post - Stop Submit With Empty Input Values Using PHP, but I do not think this will work for me because my form and processor are in a single file. I am sure this is simple, but it is extremely difficult to find any answer when browsing the web. Thanks for any help :)