?
Solved

PHP Problem with if/then and redirect statement. I can seem to get it to work

Posted on 2015-01-28
2
Medium Priority
?
61 Views
Last Modified: 2015-01-28
     <?php
$result = 6;

if ($result == 5) { 
  header("Location: staffonly2.php");
}
elseif ($result == 6) {
  header("Location: boardonly2.php");
}
elseif ($result == 7) {
    header("Location: eoconly2.php");
}
else {
    echo "<h3 class='clients'>Sorry you don't have the proper user level </h3<br />";
}
?>

Open in new window

0
Comment
Question by:Monte2256
[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 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 40576249
If you have Any white space before the opening PHP tag, it will be sent to the browser and prevent any header statements from working.
// you have
     <?php
// should be
<?php

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

765 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