Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 799351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:06:43+00:00 2026-05-14T23:06:43+00:00

when user changes password I want to show message Successfully changed! and when user

  • 0

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 
        {....
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:06:43+00:00Added an answer on May 14, 2026 at 11:06 pm

    The reason why you are witnessing the header redirect is that PHP is a server-side language and its code executes before the javascript. The way to go about is to use the javascript’s redirect.

    <script type="text/javascript">
      alert("Your Password has been changed successfully.Please login again.")
      document.location.href = 'logout.php';
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to store user entered changes to a particular table, but not show
When a user have changed something in a form, then clicks on any link
What is the best way to change a user-password remotely in Unix? This must
I am looking for a way to change the password of a local user
I need to be able to change a user's password from a cron task
I'm trying to determine how I can detect when the user changes the Windows
I'm writing an ASP.Net webform with some DropDownList controls on it. Then user changes
Assuming the you are implementing a user story that requires changes in all layers
Say a user is browsing a website, and then performs some action which changes
I want to set the LastPasswordSet attribute of a user in Microsoft Active Directory.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.