无法修改标头信息 - 已经发送的标头(输出从C:\ xamp开始)

时间:2015-11-14 19:56:02

标签: php

我严重面临的问题是:无法修改已经由out启动的标头信息标头 放在......

<?php 
if ($_POST)
{
$counter = 0;

$Role = $_POST['urole'];
$Username = $_POST['uname'];
$Userid = $_POST['password'];

// validating field values

if($Role == "Select Role" || strlen($Username)<=0 || strlen($Userid)<=0)
{
$counter = 1;

echo "<center><font color=red><h3>"."Please, Provide values for all the fields"."</h3></font></center>";

exit;
}

$dbconnect = mysql_connect('localhost','root','');

if (!$dbconnect)

    {
    die ('could not connect:'.mysql_error());
    }
 $selectdb = mysql_select_db('UGI', $dbconnect);

 $query = "select EmployeeLoginType, EmployeeUserName, EmployeePassword from EmployeeCredentials where EmployeeLoginType='".$_POST['urole']."' and EmployeeUserName='".$_POST['uname']."' and EmployeePassword='".$_POST['password']."'";

 $dbquary = mysql_query($query, $dbconnect);

if (!$dbquary)
    {
    echo "No Record Found:".  mysql_error();
    }  
    else 
        {
        $rowfetch = mysql_fetch_array($dbquary);
        }
if (!$rowfetch)
    {
    echo ("<font color='red' size='+2'>Invalid Login Credentials</font>");
    }
    else {
              //      $username = $_POST['uname'];
                    $_SESSION['uname'] = $Username;
                    $role = $rowfetch[0];
                    $name = $rowfetch[1];
                    $password = $rowfetch[2];
         }
         if (strcasecmp($role, "Manager") === 0 && $name === "Bello" && $Userid === "smile2me")
         {
                        header('Location:PeopleManagement.php');
                      exit();    
         }


        /* else if 

                        (strcasecmp ($role, 'Assistant Manager') == 0 && $name == 'Ismail' && $Userid == $password)
                       header("Location:EditEmployeeDetails.php");

                    else if

                        (strcasecmp($role, 'Employee') == 0 && $Username ==$name  && $Userid == $password)
                        header("Location:Admin.php");


                    */

}enter code here
 // echo "<font color='red'><h3><em>Invalid Login credentials: Try again</em></h3></font>";

1 个答案:

答案 0 :(得分:1)

必须在任何header()之前调用{p> echo