1 回答

TA貢獻(xiàn)1801條經(jīng)驗(yàn) 獲得超16個(gè)贊
當(dāng)您查看源代碼時(shí),您沒(méi)有發(fā)布表單,因此$_POST未設(shè)置該變量。$_POST在嘗試使用該變量之前,您應(yīng)該檢查該變量是否已設(shè)置。
<?php
include_once "InsertDataDatabases.php";
if (isset($_POST['id'])) {
$id = $_POST['id'];
$query = InsertDataDatabases::SelectDateId($id);
$item = [];
$item = mysqli_fetch_assoc($query);
?>
<form action="updatedata.php" method="post" enctype="multipart/form-data">
<?php CSRF::CreateToken(); ?>
<input type="text" name="id" value="<?php echo $item['id']; ?>"><br>
<label for="name">Name:</label>
<input type="text" name="name" value="<?php echo $item['name']; ?>"><br><br>
<label for="email">Email:</label>
<input type="email" name="email" value="<?php echo $item['email']; ?>"><br><br>
<input type="file" name="image" value="images/slider/<?php echo $item['image']; ?>"><br>
<img src="images/slider/<?php echo $item['image']; ?> " width="50px" height="50px" alt=''><br>
<input type="submit" name="updatebtn" value="UPDATE">
</form>
<?php }
- 1 回答
- 0 關(guān)注
- 178 瀏覽
添加回答
舉報(bào)