Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default redirect?!?!?

    Hi i am wondering if anybody knows how to redirect a user to another page if a
    statement returns true? Here is the code, I am using PHP:

    // check if database has content
    if ($totalRows_login != 1)
    {
    echo'you are not logged in';
    }
    else{
    echo ("addimage.php"); // clearly wrong, but how would i go about redirecting
    the user to another page?
    }

    any help would be great

    Bethan

    bethan81 Guest

  2. Similar Questions and Discussions

    1. redirect to ..
      hi, I have several page where you can edit the record When you modified the record you suppose to go where you came for example you can...
    2. redirect to guest if first redirect is doesnt work for a user
      Hi all, I was wondering if anyone could help me solve a problem Once a user hits a certain webpage ..I try to redirect them to another using...
    3. How to Redirect?
      I have a PHP script that waits for a file to appear, and then redirects to it. This works fine: <?php $filename = 'NewData.html'; while (!...
    4. [PHP] Redirect URL
      Hi I have form in file register.php. The action of this form is the same - register.php the form validation script is included in this file like...
    5. Redirect to New Browser Window like Response.Redirect
      That worked just fine for me as long as you put that open statement on one line rather than 2. "michel" <michely3k@yahoo.com> wrote in...
  3. #2

    Default Re: redirect?!?!?

    You could try this, it uses the header function.

    [url]http://www.phpfreaks.com/quickcode/code/292.php[/url]

    -Jason
    JNadon Guest

  4. #3

    Default Re: redirect?!?!?

    .oO(bethan81)
    >Hi i am wondering if anybody knows how to redirect a user to another page if a
    >statement returns true?
    header("Location: $url");
    exit;

    where $url has to be an absolute address. You can use a predefined
    variable to build it, e.g.

    header("Location: http://$_SERVER[HTTP_HOST]/yourpage.html");
    exit;

    HTH
    Micha
    Michael Fesser Guest

  5. #4

    Default Re: redirect?!?!?

    .oO(JNadon)
    >You could try this, it uses the header function.
    >
    >[url]http://www.phpfreaks.com/quickcode/code/292.php[/url]
    The Location header requires an absolute address, so the code on that
    page is wrong. Additionally after setting the header the script should
    be terminated using exit;, otherwise it will continue to run.

    Micha
    Michael Fesser Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139