dongmufen8105 2015-10-28 05:22
浏览 8

无法更新查询[重复]

This question already has an answer here:

I am trying to update the query and display into the next page. Here is my code,problem is i will get a warning message "Cannot modify header information - headers already sent". Please help.

$id = (isset($_GET['id'])) ? $_GET['id'] : '';
$val = view_data($id);
if (empty($_POST) === false) {
    $title = $_POST["offered"];
    $description = $_POST["description"];
    $id = $_POST["id"];
    $update = update($title, $description, $id);
    if ($update) {
        header("location:hotel2_galery.php");
    }
}

HTML

<form action="hotel2_galery_edit.php" method="post" class="col-sm-4">
   <div class="form-group has-info">
      <input type="hidden" name="id" value="<?php echo $val->offer_id;?>">
      <label class="control-label" for="inputSuccess">Offer title
      </label>
      <input type="text" class="form-control" name="offered" id="offered" value="<?php echo $val->offers_name; ?>">
      <label>Offer Description
      </label>
      <textarea id="description" name="description" class="form-control " rows="3">
      <?php echo $val->offers_description; ?>
      </textarea>
      <br>  
      <button type="submit" class="btn btn-primary">
      <span>UPDATE
      </span>
      </button>
   </div>
</form>
</div>
  • 写回答

1条回答 默认 最新

  • doutu6658 2015-10-28 05:25
    关注

    Try

    echo "<script>location.href='hotel2_galery.php'</script>";
    

    instead of

    header("location:hotel2_galery.php");
    

    This is a temporary fix. If you show us entire code, we may help you further.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于无人驾驶的航向角
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退