Checking FORM with reCaptcha using jQuery and if values are OK, send FORM to php file that will save VALUES to database

Checking FORM with reCaptcha using jQuery and if values are OK, send FORM to php file that will save VALUES to database

my problem is that im having FORM with recaptcha on end. Im using jQuery script to check, if values are fine. Problem is that when its fine, i need to send informations from that FORM to php file, which will save them to database.

I dont know what should i do. I tried :
$("form").submit("reg.php", data);
$.post("reg.php");
$.post("reg.php", $("#form").serialize());
....

when i redirect page with
window.location = "register.php"
it redirected me, but values from form were lost.
  1. function validateCaptcha() { challengeField = $("input#recaptcha_challenge_field").val(); responseField = $("input#recaptcha_response_field").val(); var html = $.ajax({ type: "POST", url: "validateform.php", data: "form=signup&recaptcha_challenge_field=" + challengeField + "&recaptcha_response_field=" + responseField, async: false }).responseText; if(html == "success") { HERE I NEED CODE, THAT WILL PROCESS MY FORM TO REGISTER.PHP AND KEEP VALUES IN IT. //Add the Action to the Form  //Indicate a Successful Captcha } else { $("#captcha-status").html("<p class=\"red bold\">The security code you entered did not match. Please try again.</p>"); Recaptcha.reload(); } }
My php file printing values..

  1. if($_POST['submit'] == "submit") { $mesto = mysql_real_escape_string($_POST['mesto']); $ulice = mysql_real_escape_string($_POST['ulice']); $cislo = mysql_real_escape_string($_POST['cislo']); $stat = mysql_real_escape_string($_POST['stat']); $posta = mysql_real_escape_string($_POST['posta']); $lat = mysql_real_escape_string($_POST['lat']); $lng = mysql_real_escape_string($_POST['lng']); $nick = mysql_real_escape_string($_POST['nick']); echo $ulice. '<br>'; echo $cislo. '<br>'; echo $stat. '<br>'; echo $posta. '<br>'; echo $lat. '<br>'; echo $lng. '<br>'; echo $nick. '<br>'; }