When the user changes the password, I want to show the message "Successfully Reached" and when user alert box click the OK button, I call logout.php and force the user to log in with a new password. But the problem is PHP Header () is not waiting for the alertbox and goes directly to logout.php My code -
if ($ count == 1) {$ sqlchange = "UPDATE $ tbl_name set password = '$ newpassword' Where userId = '$ myusername'"; Not set ($ result); $ Result = mysql_query ($ sqlchange, $ link); If ($ result & gt; 0) {? & Gt; & Lt; Script type = "text / javascript" & gt; Warning ("Your password has been changed successfully. Please log in again."); & Lt; / Script & gt; & Lt ;? Php header ("location: logout.fp"); Go out; } Else {....
You are seeing header redirection that PHP is a server -Side language and its code executes before javascript How to go about using javascript redirects
& lt; Script type = "text / javascript" & gt; Warning ("Your password has been changed successfully. Please log in again.") Document.location.href = 'logout.php'; & Lt; / Script & gt;
Comments
Post a Comment