I'm Working with register module with xmlHttpRequest. I have checking all. When i was trying to redirect after successfull its displaying the response with in the given div.
<script type="text/javascript">
function showRegister()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("result").innerHTML=xmlhttp.responseText;
}
}
var fname = document.getElementById("userfname").value;
var lname = document.getElementById("userlname").value;
var email = document.getElementById("userfemail").value;
var pass = document.getElementById("userfpass").value;
var gender = document.getElementById("userfgender").value;
var umonth = document.getElementById("usermonth").value;
var uday = document.getElementById("userday").value;
var uyear = document.getElementById("useryear").value;
var tc = document.getElementById("tc").checked;
var registervalues = "fname=" + fname + "&lname=" + lname + "&email=" + email + "&pass=" + pass + "&gender=" + gender + "&umonth=" + umonth + "&uday=" + uday + "&uyear=" + uyear + "&tc=" + tc + "";
xmlhttp.open("POST","checkregister.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send(registervalues);
}
</script>
<?php
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$pass = $_POST['pass'];
$gender = $_POST['gender'];
$month = $_POST['umonth'];
$day = $_POST['uday'];
$year = $_POST['uyear'];
$terms = $_POST['tc'];
if($fname == "" || $lname == "" || $email == "" || $pass == ""){
echo "<p style='padding: 3px; text-align: center; border: 1px solid red;'>Please fill all the details</p>";
}
else if($month == "Month" || $day == "day" || $year == "Year"){
echo "<p style='padding: 3px; text-align: center; border: 1px solid red;'>You must indicate your full birthday to register</p>";
}
else if($terms == "false" || $terms == FALSE){
echo "<p style='padding: 3px; text-align: center; border: 1px solid red;'>You must agree our terms & conditions</p>";
}
else{
header("Location: profile.html");
exit;
}
?>
Please help me ..