0

i want that after validation of form with ajax it will be redirect on another page but my coding is showing result in specfic div id=result . i am getting result on index.php which coding is following

<div class="c_right">
<div>
<div class="t_h_c">
Hi Guest
</div>
<div id="result" class="error">

</div>
<div class="username">
Username:
</div>
<form  name="signin" id="signin"  method="post"> 
<div class="f_l2">

 <input type="text" class="form_username" name="username" maxlength="40" >
  </div>
 <div style="clear:both;">
</div>
<div class="username">
Password:
</div>
<div class="f_l2">
 <input type="password" class="form_username" name="pass" maxlength="50">

</div>
 <div style="clear:both;">
</div>
<div class="username"></div>
<div class="f_l2" >
       <a href = "javascript:void(0)" onclick = "document.getElementById('light3').style.display='block';document.getElementById('fade3').style.display='block'"><img src="img/jpg/sinup.png"/></a>
</div>
<div class="f_r" >
<img src="img/jpg/sin-in.png" onClick="showHint()" />
 </form>
</div>
</div>
</div>


<script type="text/javascript">
// function create GetXmlHttpObject
function showHint()
{

var t2lFname=document.signin.username.value;
var t2lLname=document.signin.pass.value;

var parameters="firstname="+t2lFname+"&lastname="+t2lLname;

var xmlhttp;
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 == 1) 
{
           document.getElementById("chart").innerHTML ="<img src='img/ajax-loader.gif' />";
}

  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("result").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("POST","thank-you.php?username="+t2lFname+"&pass="+t2lLname,true);

xmlhttp.send();
}

</script>

below coding is of thank-you.php i want that after validation index.php will move to members.php now after validation members.php result is showing into resulty id.

<?php

echo $_REQUEST['username'];
echo $_REQUEST['pass'];
include("connection.php");
$query = mysql_query("SELECT COUNT(*) FROM user");
list($number) = mysql_fetch_row($query);

 //Checks if there is a login cookie

 //if the login form is submitted 

 if (isset($_REQUEST['username'])) { // if form has been submitted



 // makes sure they filled it in

    if(!$_REQUEST['username'] | !$_REQUEST['pass']) {

        die ('<span class="eror">You did not fill in a required field.</span>');

    }

    // checks it against the database



    if (!get_magic_quotes_gpc()) {

        $_REQUEST['email'] = addslashes(@$_REQUEST['email']);

    }

    $check = mysql_query("SELECT * FROM user WHERE un = '".$_REQUEST['username']."'")or die(mysql_error());



 //Gives error if user dosen't exist

 $check2 = mysql_num_rows($check);

 if ($check2 == 0) {
die ("User name does not exist");
?>

    <?php

                }

 while($info = mysql_fetch_array( $check ))     

 {

 $_REQUEST['pass'] = stripslashes($_REQUEST['pass']);

    $info['password'] = stripslashes($info['password']);

    $_REQUEST['pass'] = md5($_REQUEST['pass']);



 //gives error if the password is wrong

    if ($_REQUEST['pass'] != $info['password']) {

        die ('<span class="eror">Incorrect password,<i> please try again.</i></span>');

    }
    else 

 { 


 // if login is ok then we add a cookie 

     $_REQUEST['username'] = stripslashes($_REQUEST['username']); 

     $hour = time() + 600000000000000000000000000; 

 setcookie(ID_my_site, $_REQUEST['username'], $hour); 

 setcookie(Key_my_site, $_REQUEST['pass'], $hour);  

include("time.php"); 



$conform=mysql_query("INSERT INTO user_ts (user_ts_user,user_ts_uli,user_ts_date, user_ts_umd) 
VALUES ('$_REQUEST[username]','$x','$d','$time_code')");
 if ($conform)
 {
 //then redirect them to the members area 

setcookie('md',$time_code);
setcookie('li',$x); 
setcookie('h',$h); 
setcookie('m',$m); 
# index.php is moved to members.php
 header("Location: members.php"); 

?>
 <?
 }
 else
 {
     die ('Not Inserted');
 }
 } 

 } 

 } 

 else 

{    



 // if they are not logged in 

 ?>

 <?php 

 } 



 ?> 
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by diafol
0

i want that after validation of form with ajax it will be redirect on another page but my coding is showing result in specfic div id=result . i am getting result on index.php which coding is following

I'm afraid that doesn't make much sense to me. Judging by the number of replies, I don't think many others understand it either. Could you rephrase your problem please?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.