2016-05-21 34 views
0

目錄及其代碼工作正常訪問Php我在遇到問題,我的php代碼。

直接當例如subdomain.domain.com/folder_name_c/index.php?id=1

但是當我使用header()函數來重定向到該目錄它產生錯誤。 [處理此指令時發生錯誤]

這是我正在使用的代碼。

if($_POST){ 

    if($_POST['xyz'] != '' && $_POST['xyz2'] != ''){ 
     header("Location http://subdomain.domain.com/folder_name_c/index.php?id=".$_POST['comp']."&xyz=".$_POST['xyz']."&xyz2=".$_POST['xyz2']); 
    }else if($_POST['month'] != ''){ 
     header("Location http://subdomain.domain.com/folder_name_c/index.php?id=".$_POST['comp']."&xyz=".$_POST['xyz']); 
    } 

} 

幫助將不勝感激。

回答

0

我認爲這個問題是在

header("Location: ... 

你需要的位置

+0

後冒號你是正確的,這是問題。這是多麼愚蠢。有時候,一些錯誤會讓你陷入困境。非常感謝。 :) – Auj

+0

我知道的感覺:P –