Is it possible to use if else statements multiple times?
What I mean is
if ($usrlevel == $adminlevel){
do something
if not does it match userlevel
if not redirect to unauthorized.php
If anyone has any advice on this it would be much appreciated.
or even another way to have user levels in my system.
Thanks
if else multiple times?
Moderator: General Moderators
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
looks like you are struggling for a basic if..elseif...else statement
Code: Select all
if (condition1){
}elseif(condition2){
}else{
header(Location: file.php);
}Yeah I am struggling a bit lol,
thanks for this.
Can this go on for a while?
i.e.
etc?
thanks for this.
Can this go on for a while?
i.e.
Code: Select all
if (condition1){
}elseif(condition2){
}elseif(condition3){
}elseif(condition4){
}else{
header(Location: file.php);
}- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
Code: Select all
if (condition1){
}elseif(condition2){
}elseif(condition3){
}elseif(condition4){
}else{
header(Location: file.php);
}if php can execute one thing like if..elseif..else then it also should be able to execute if..elseif..elseif...else as well
- ambivalent
- Forum Contributor
- Posts: 173
- Joined: Thu Apr 14, 2005 8:58 pm
- Location: Toronto, ON
You might also want to look at switch()