2017-04-11 106 views
0
<?php 
    error_reporting(0); 

    include("../../php/open.php");// db-connection 



     print_r($_REQUEST); 
     if(isset($_REQUEST['form1'])) 
      { 


      if(!empty($_POST['description'])){ 

       $id=$_REQUEST['id']; 

       $field_name = $_REQUEST['field_name']; 

       $paragraph1=$_REQUEST['description']; 

       $text = $paragraph1; 

       $query ="UPDATE website_data SET field_value = '$text', field_name= '$field_name' WHERE id = '$id';"; 

       $result=mysql_query($query); 
       if($result==true){ 
        $url="index.php?page=content_edit"; 
        die('<script type="text/javascript">window.location.href="' . $url . '";</script>'); 
       } 
       } 
       else{ 
        echo "<script>alert('page body can not be empty')</script>"; 
       } 
     } 

    ?> 

,並顯示輸出....爲什麼這個代碼不重定向頁面

Output screenshot

+0

也許一個想法是設置**錯誤報告** 1,使其顯示糾正錯誤。 –

+0

404是一個未發現的問題,因爲在你的文件沒有找到...路徑看起來好嗎?那裏的文件? etc – Dale

+0

我認爲路徑是正確的,文件是正確的地方。我檢查了更多次。當我更新內容時,它的更新成功,但不重定向頁面,並顯示此消息 – atiq05

回答

0

請使用此:

if($result==true){ 
    echo "<script type='text/javascript'>window.location.href='index.php?page=content_edit' 
    </script>"; 
       } 
+0

仍然同樣的問題的人,但內容更新成功@Ajay Malhotra – atiq05

+0

什麼是輸出,你越來越? – Aaron

+0

if($ result == true){ echo「」; die(); } – Aaron

1

或者您可以使用PHP的頭功能重定向,但不要忘記從刪除的print_r頂端。

代替

die('<script type="text/javascript">window.location.href="' . $url . '";</script>'); 

使用

header('location : '.$url); 
+0

如果我使用「頭」而不是「死「,並從頂部刪除print_r更新內容,但鋼不會重定向頁面。它現在顯示一個空白頁面@D。 Pachauri – atiq05

+0

使用exit;只是在標題之後,它會停止腳本進一步執行。 –

+0

仍然是同樣的問題@D.Phahauri – atiq05

相關問題