无法在PHP中转发页面

时间:2013-04-02 05:21:51

标签: 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
                    }
                    ?>

2 个答案:

答案 0 :(得分:0)

剥离或删除反斜杠。

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

答案 1 :(得分:0)

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