You can do this with AJAX and jQuery
$(document).ready(function() {
// send add record Ajax call request to YourResponse.php
$("#YourSubmitButton").click(function (e) {
e.preventDefault();
var firstField = $('#firstField').val();
var secondField = $('#firstField').val(); // As many fields you have on your Form
if(Here your validation will work)
{
alert("Please fill all fields!");
return false;
}
var dataString = 'firstField='+ firstField + '&secondField='+ secondField ; //build a post data structure
jQuery.ajax({
type: "POST", // HTTP method POST or GET
url: "YourResponse.php", //PHP Page where all your query will write
dataType:"text", // Data type, HTML, json etc.
data:dataString, //Form Field values
success:function(data){
$("#YourDivId").html(data); //Your Div Id Where Your listing is placed
$("#PopUPDiv").hide(); // Hide Div after success
}
});
});
In YourResponse.php page you fire your Insert query and after that fire Select query just "print_r" your result array.
If you still need help feel free to comment. I will be there.