The best way to do form validation is with a combination of JavaScript and PHP.
The reason why you want to perform JavaScript validation is to give the users a chance to correct their errors without submitting the form. Plus, it will stop any casual mistakes. You will also want to ensure validation on the back-end in case JavaScript is turned off.
Either way, sanitizing your data should be part of this process. Use any of these WordPress functions to help you there: Data Validation.
For JavaScript validation, I recommend the jQuery Validation plugin. It’s super easy to implement and customize.
As for your PHP validation, you can try adding this to check for empty values: $_POST['title'] != ''