You can either do it before or after form submission.
Before would be using Javascript (search for form validation) and after you'd check to see whether the value of $_POST variable is non-empty and if it is empty send them back to the same page.
It's best to use both in case people have javascript disabled in their browsers.