(PHP)how to hold javascript alertbox on screen

Posted by Piyush on Stack Overflow See other posts from Stack Overflow or by Piyush
Published on 2010-05-16T11:18:47Z Indexed on 2010/05/16 11:20 UTC
Read the original article Hit count: 148

Filed under:
|

when user changes password I want to show message "Successfully changed!" and when user clicks on OK button of alert box I call logout.php and force user to login with new password.But the problem is PHP header() is not waiting for alertbox and directly goes to logout.php. my code-

if($count==1)
{
    $sqlchange="UPDATE $tbl_name SET password='$newpassword' WHERE userId='$myusername'";
    unset($result);
    $result=mysql_query($sqlchange,$link);
    if($result>0)
        { ?>
        <script type="text/javascript">
        alert("Your Password has been changed successfully.Please login again.");
        </script>
        <?php
        header("location:logout.php");
        exit;
        }
    else 
        {....

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript