Hi, I have a form and I want to display a pop-up before submitting the data.Problem is I cant call confirmation box at onsubmit or onclick event, as pop-up will appear only if no validation errors are there.

Something like this:
Code:
<?PHP if(empty($err_array)){ ?>
			<script> 
			var ans = window.confirm('Are you sure you want to submit this form?');
					if(ans == true){ </script>
							<?PHP dbInsert($tbl,$insert_array);
                            echo "<div class='alert alert-success'>
                            <button class='close' data-dismiss='alert' type='button'>&times;</button>
                            Data Inserted
                            </div>";
                            unset($_POST); ?>
					<script>   } </script>
<?PHP } ?>
I am trying to do this since long.Is there any solution to display confirmation window like this?