Solved

Redirection in PHP

Posted on 2003-11-30
5
249 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
  • 2
5 Comments
 
LVL 24

Expert Comment

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

Author Comment

by:justmelat
Comment Utility
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
Comment Utility
 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
Comment Utility
User resolved; closed, 60 points refunded.

Netminder
Site Admin
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now