Solved

Redirection in PHP

Posted on 2003-11-30
5
255 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

734 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