0
当我评论一个特定的职位,并编辑这条评论我想继续留在这个职位在同一页面,但它重定向主后页面。我怎样才能解决这个问题。 这是我更新的评论页面代码页面重定向不是完美的工作与页面内容
<?php
require_once('config.php');
require_once('user_logedin.php');
?>
<?php
if(!isset($_REQUEST['c_id'])) {
header("location:home4.php");
}
else {
$id = $_REQUEST['c_id'];
//echo $id;
}
?>
<?php
if (isset($_POST['update'])) {
$msg = $_POST['editmsg'];
$update = mysqli_query($con,"UPDATE `newsfeedcomment` SET `comment_body`='$msg' WHERE `comment_id`='$id' LIMIT 1");
if ($msg) {
//header("location:home4.php?post_id=.$id");
header("Location:home4.php?post_id=".$id);
//header("Location:home4.php");
}
}
?>
这是工作,但不显示页面内容
因为第一个重定向正在检查'c_id',所以最后的重定向不应该使用查询参数'c_id'而不是'post_id'? – sowa
摆脱关闭并重新打开php标签。你在这里产生输出,所以'header'将不再工作。 – Jeff