36 users online (1 members and 35 guests)  

Thread: js redirect


  Results 1 to 3 of 3

Related

  1. Redirect and remember me    Forum: Javascript Forum
    Replies: 1
  2. Redirect after animation    Forum: Javascript Forum
    Replies: 0
  3. Auto-Redirect    Forum: HTML Forum
    Replies: 1
  4. redirect advice please    Forum: Search Engine Optimization - SEO - Forum
    Replies: 4
  5. need syntax for redirect to target    Forum: PHP Forum
    Replies: 3
  1. #1
    f&m's Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2005
    Posts
    4

    js redirect

    hi, i'm trying to redirect this js alert but it is not working

    if{
    $Login = "1";
    $_SESSION["username"] = $_POST["username"];


    header("location: backup1.php");
    }

    else
    {
    echo("<script language='javascript'>alert('wrong password.') window.redirect="login.php" </script>");

    }

    can anyone help me?

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    The problem is two-fold. Your nesting the quote characters incorrectly and missing a ; symbol. Try this

    Code:
    else
    {
    ?>
    <script language="javascript">
    alert('wrong password.');
     window.redirect='login.php';
     </script>
    <?php
    }
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    f&m's Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2005
    Posts
    4
    hi, it works, thnx



Tags for this Thread