SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2005
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can I go to a new page after click ok in alert

    Hello,
    I know this thread may be more like in the Javascript forum, but I need your help.

    My codes are
    PHP Code:
    <?php
    ....
    if (
    isExistingShowtime($db)) { 
    ?> 
        <script language="javascript"> 
        <!-- 
            alert("this showtime has been already in my schedule"); 
             
        --> 
        </script> 
    <?php 
        header
    ("location:$_SERVER[HTTP_REFERER]"); 

    } else { 

    ?>
    I want to check if $db is the existing one, and if it is, it shows alert, and when ok button is pressed, go back to the calling page.

    However, when isExistingShowtime($db) is true, it always redirects to the calling page without showing alert.

    And if I comment out like this,

    PHP Code:
    //  header("location:$_SERVER[HTTP_REFERER]"); 
    it shows alert, but still in the same page when I click ok.

    Is there any way I can accomplish my goal?

    Thanks

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use javascript to do the redirect. like you said, this belongs in the javascript forum.

    the only thing your using php for is to decide whether or not to echo the javascript.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •