faqts : Computers : Programming : Languages : PHP : Common Problems : Redirects

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 3 people (33%) answered Yes
Recently 1 of 3 people (33%) answered Yes

Entry

How to redirect to 4 different pages based on 4 "userlevel" from MySQL ? "id" is passed. URGENT !!

Apr 10th, 2004 08:08
Matt Chatterley, Biju Kaimal,


As long as you want to redirect at the beginning of a script (before ANY
text or HTML headers are sent), you can use the header() function to
send a string such as: header("Location: http://redirect.to.here/page1.php")
This means, if you retrieve your userlevel from MySQL (presumably
obtained via a query supplying id as a parameter), you can perform
multiple if() or better one switch() operation on it, outputting the
appropriate page to redirect to via header().