Using PHP, how do I display error messages above the form, upon the user not entering a data?
Is the form itself "insert.php"? If so, then you can:
1. Check that the form has been submitted (e.g., its corresponding incoming variables are set. This can be checked with [man]isset[/man]).
2. Validate the required input, e.g., if strlen($_POST['x']) == 0, record the invalid input in an array of error messages.
3. If the array has error messages has any elements, stop processing the form and print the error messages with the form (that has the data automatically filled in). Else, process the form and display the results.
Also, if the user does enter valid data, how do I submit the form?
You cannot submit the form (the user is the one who does that). You can process the form, but the specifics is dependent on what you want to do, of course. The form processing could record the data in a database, send an email, compute a result, etc.