2013-04-02 68 views
0

我有一個php頁面。當用戶點擊編輯按鈕時,我的所有其他字段數據都會出現在相應的文本框中,並且如果他提交表單我的數據正在更新。但我的問題是它沒有轉發到我尊敬的頁面。無法在php中轉發頁面

我表示它是這樣的header('Location: /profile.php');轉發它在我的個人資料頁 可能是什麼原因?

我的全碼:

<?php 
        include '../../../include/connection.php'; 
        $idd =$_REQUEST['id']; 
        $resultt = mysql_query("SELECT * FROM budget WHERE budget_id = '$idd'"); 
        $test = mysql_fetch_array($resultt); 
        if (!$resultt) 
         { 
          die("Error:<font color='red'> Data not found..</font>"); 
         } 
        $budget_id=$test['budget_id']; 
        $heads_id=$test['heads_id']; 
        $amount= $test['amount']; 
        $from_date=$test['from_date']; 
        $to_date= $test['to_date']; 

        if (isset($_POST['submit'])) { 
         $headsid=$_POST['headsid'] ; 
         $amount= $_POST['amount'] ; 
         $todate=$_POST['todate'] ; 
         $frmdate= $_POST['frmdate'] ; 
         mysql_query("UPDATE budget SET heads_id ='$headsid',amount ='$amount',from_date ='$frmdate' ,to_date ='$todate',updater_id ='$uid',updated_date=NOW() WHERE budget_id = '$idd'") 
           or die(mysql_error()); 
         header('Location: /profile.php');// PROBLEM HERE UNABLE TO FORWARD TO THE PAGE 
        } 
        ?> 
+0

是否已確認'$ _ POST [ '提交']'設置?嘗試將表單發佈到'phpinfo()'頁面以確保。 – PaulProgrammer

+0

無法轉發此頁面?是你得到404錯誤頁面沒有找到或重定向它自我沒有發生 – Devesh

+0

@Devesh它仍然在同一頁面,不改變我的網址 –

回答

0

條或移除反斜線。

header("Location: http://example.com/path/path/profile.php"); 
exit; 
+0

仍然是同樣的問題 –

+0

嘗試把整個路徑代替。 –

+0

同樣的問題... –

0
header('Location: profile.php'); 
die; 
+0

我試過了,但是頁面空白,我的網址沒有變化,它仍然保持不變 –