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 7012159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:13:10+00:00 2026-05-27T22:13:10+00:00

I have tried using header() to programmatically take the user to a different page

  • 0

I have tried using header() to programmatically take the user to a different page
in my site after they see then dismiss an alert() box, but it’s not doing what I need.

I need to:

1) have a javascript alert() echoed to the browser

2) then after the alert() box is dismissed, I need to jump to another page

3) saying ‘use ajax’ won’t help me here as I’ve got a full plate just coming to grips with php,
mysql, html5 and javascript. Plate is full, ajax -> later.

In the code below I never see the alert() — my browser just immediately shows me shimmyLogin.php.

If I comment out the ‘header()’ call, then I see my alert() just fine — but then I’m not
doing what I need to do after the alert(), which is to programmatically take my user to shimmyLogin.php.

I’m pretty sure I know why this is happening but my question is — is there a way to

1) pop up an alert() box

2) then after the user dismisses the alert(), I can then do a header() (or some other way)
to jump to my other page shimmyLogin.php?

I’m really new to programmatically navigating the pages of a site and I’m aware of header()
but obviously it will not work here for the 2 things I need to do above.

Here’s the code:

if(showAlertBox("Unexpected error! "))
{
     header('Location: http://localhost/shimmyDooHah/shimmyLogin.php');
}            

where showAlertBox is just:

function showAlertBox($messageToDisplay)
{
    echo '<script type="text/javascript">'
        . 'alert("' . $messageToDisplay . '")</script>';

    return true;
}
  • 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-27T22:13:11+00:00Added an answer on May 27, 2026 at 10:13 pm

    In your showAlertBox() – you need to add after the alert(“bla-bla”); this line:

    window.location = "http://www.google.com/"
    

    It will take the user to the url you will put there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that sets a cookie and then redirects the user to
I want to desgin a web-site using GWT. Which will contain Header, Footer, Left
I have tried without success setting cookies using Perl CGI. My code looks like
I have tried using the obvious method as outlined in the following example but
I have a C# namespace defined as A.B.C which I tried using in a
I have a C header file that I have precompiled using the gcc -E
We're currently using WPF to create a multi-page invoice document, to then be printed
I have tried using fopen, file-get-contents and a curl request but I always get
Should I used AVPlayer or MovieController? I have tried using AVPlayer but I cannot
I have tried all the possible options to use openID delegation on my site,

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.