Solved

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

Posted on 2015-01-28
2
59 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 83

Accepted Solution

by:
Dave Baldwin earned 500 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
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 40576629
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wordpress Query 5 45
MySQL limit and not so limited 13 41
Codeigniter Query Help Returning JSON 4 49
Why is PHP Storm giving me an undefined constant error? 4 39
These days socially coordinated efforts have turned into a critical requirement for enterprises.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

726 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