Results 1 to 5 of 5
  1. #1
    Newbie
    Join Date
    March 20th, 2005
    Posts
    7
    redirecting to a different page using php
    Hello,
    I am writing a php script to have users login, upon successful login I want them to go to one page, if they have not registered I want them to go to a different page, any ideas how to redirect to a different page after an if statement? I have tried using the require and include functions, but they just add the page ontop of the login page. any help would be appreciated.
    thanks,
    davfe

  2. #2
    Not Verif-Lidated infoTim's Avatar
    Join Date
    January 18th, 2005
    Location
    Sunny Florida
    Posts
    1,021
    Header("Location: /page1.html");
    Tim
    consultant by day, affiliate by night

  3. #3
    Newbie
    Join Date
    March 20th, 2005
    Posts
    7
    I tried this, this is what I get, Warning: Cannot modify header information - headers already sent by (output started at /home/davehazh/public_html/agntlogin.php:7) in /home/davehazh/public_html/agntlogin.php on line 25
    echo"You Must Enter Your TREC License #";

  4. #4
    Full Member Tech Evangelist's Avatar
    Join Date
    March 16th, 2005
    Location
    Mesa, AZ
    Posts
    374
    The header redirection must appear before you send any html information. In other words, before the Doctype and <html> declarations.

  5. #5
    Animal Lover
    Join Date
    January 18th, 2005
    Location
    oz
    Posts
    1,210
    If you are getting them to sign up using a form then you can use a separate script to do it...that's how I usually do it. So your form action with be "checkregister.php" or something. Then in checkregister (which is a pure php script) you can then do the if statement after you've got the post variables and use the header() statement suggested.

    Oscar

  6. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Trouble with detail page redirecting to Amazon UK homepage
    By smnash in forum Cusimano.com Scripts
    Replies: 3
    Last Post: November 29th, 2006, 11:33 AM
  2. Redirecting to home page
    By tr10 in forum Search Engine Optimization
    Replies: 1
    Last Post: April 16th, 2005, 08:00 PM
  3. Why are eBay links redirecting to a dead page?
    By Tracy in forum Commission Junction - CJ
    Replies: 7
    Last Post: May 7th, 2004, 01:59 PM
  4. Redirecting to page without MY PID ??
    By Dirk in forum Commission Junction - CJ
    Replies: 7
    Last Post: November 11th, 2003, 09:01 AM

Posting Permissions

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