Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Redirection in PHP

Posted on 2003-11-30
5
Medium Priority
?
257 Views
Last Modified: 2006-11-17
Hi, I am setting up a login screen.  If my user enters the correct id and password, I want them to go to say - mainPage.htm, if they enter the wrong info, then I want them to go to badAnswer.htm.  I usually work with ASP and it has a redirection function that allows me to input the pages I want to go to and when that function line is encounter - the user is immediately take to the listed page.  Does php have some type of redirection function, if so, how does it work and how can I implement it in my site?

Thank you in advance.
0
Comment
Question by:justmelat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 24

Expert Comment

by:shivsa
ID: 9846404
if ($answer == 'good') {
  header("Location: good.html");
} else {
  header("Location: bad.html");
}
0
 
LVL 1

Author Comment

by:justmelat
ID: 9859976
I can user the header function.  It causes problems if something is above this info.  But what I did figure out:
echo "<script>document.location.href='http://127.0.0.1/dashboard/CPLindex.htm';</script>";

I just put the javascript refernce in php's echo command.  it worked.  THanks for your help though.
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9861120
 Good to know you got the issue resolved. You can close the question by following this guidelines:

http://www.experts-exchange.com/help.jsp#hs5
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 11660578
User resolved; closed, 60 points refunded.

Netminder
Site Admin
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question