此页面不显示在浏览器中,只有我的标题显示。我想显示表单并显示数据库中的PHP值。但是当我点击editpost.php上的编辑页面时,这个页面就没有显示任何数据。
<?php
include "../admin/inc/header.php";
// include "../helpers/functions.php";
?>
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="add-post-form">
<?php
$id = $_GET['id'];
$userHandler = new userHandler();
$getPost = $userHandler->selectPost($id);
if ($id != null && isset($_POST['update'])) {
$updatePost = $userHandler->updatePost($id, $_POST['title'], $_POST['date'], $_POST['body']);
}
?>
<form action="editpost.php?id=<?php echo $id; ?>" method="post">
<div class="form-group">
<label for="title" class="mt-2">Title</label>
<input type="text" name="title" id="title" class="form-control" value="<?php echo $getPost['title']; ?>">
</div>
<div class="form-group">
<label for="date" class="mt-2">Select Date</label>
<input type="date" name="date" id="date" class="form-control" value="<?php echo $getPost['date']; ?>">
</div>
<div class="form-group">
<label for="mainpost" class="mt-2">Main Post</label>
<textarea name="body" id="mainpost" class="form-control"> <?php echo $getPost['body']; ?> </textarea>
</div>
<input type="submit" name="update" value="Update" class="btn btn-primary mt-2">
</form>
</div>
</div>
</div>
</div>发布于 2022-01-03 16:46:27
尝试清除cookie和服务器缓存。如果它不能工作,可以查看任何未完成函数的外部php脚本(我指的是缺少}或;字符)。
https://stackoverflow.com/questions/70568870
复制相似问题