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 have tried using the obvious method as outlined in the following example but
I have tried using a stemmer but the words it produces are just not
I have a program that monitors debug messages and I have tried using a
I am trying to programatically unzip a zipped file. I have tried using the
Hi I want to create a JSON array. I have tried using: JSONArray jArray
Have you tried using MVC or any other UI pattern for GWT client code.
Have you tried using straight javascript (rather straight ECMAscript 3 standard) in Flex applications,
We have tried it using an orm mapper tool, but it opens en closes
I have just tried using the NSArchiver but for some reason I am getting

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.