2015-11-14 54 views
1

我認真面對的問題:無法修改已經出來 放在開始的頭信息頭......不能更改頭信息 - 已經(輸出發送頭開始在C: XAMP

<?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>"; 
+0

夥計檢查您的變量之前試圖訪問這些設置'$角色= isset($ _ POST [ 'urole'])$ _ POST [ 'urole']。?假;'。 – Ohgodwhy

回答

1

header()必須在任何echo之前調用

相關問題