Here is the basic code to go on: In the form HTML make the file the form submits to the same as the file thats displaying the form and make sure this hidden input field is added:
HTML Code:
<input type="hidden" name="action" value="update">
Then in your PHP, near the top before you do the stuff to display the form:
PHP Code:
if ($_POST['action'] == 'update') {
// your code here to process the form data, which is in the $_POST array
// your query
// lets redirect the user -- make sure your change the url
$url = "URL_TO_REDIRECT_TO";
// replace PHRASE_NAME with a title for the phrase you want to show, ie the thanks message and add it to the Front-End Redircet Message group
eval(print_standard_redirect('redirect_PHRASE_NAME'));
}