類別的修改功能
1,在類別展示操作頁面修改這裡新增a標籤
#點擊a標籤進行跳轉
#新建typeupdate.php檔案
程式碼如下:
<?php
include 'include/mysqli.php';
$id= isset($_GET["id"])?$_GET["id"]:0;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改类别</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<form method="post" action="typesave.php?action=update">
<ul class="typecontent">
<?php
$id=isset($_GET['id'])?$_GET['id']:1;
$sql="select *from type where id='$id'";
$result=$mysqli->query($sql);
$row=$result->fetch_assoc();
?>
<li>父类名称<select name="fid">
<option value="0">根目录</option>
<?php
$fid=$_GET['fid'];
$sql="select *from type where id=$fid order by orderid desc";
$result=$mysqli->query($sql);
while($row=$result->fetch_assoc()){
?>
<option <?php if($row['id']==$fid){echo "selected";}?> value="<?php $row['id']?>"><?php echo $row['typename']?></option>
<?php
}
?>
</select></li>
<?php
$id=$_GET['id'];
$sql1="select *from type where id=$id order by orderid desc";
$result1=$mysqli->query($sql1);
while($row1=$result1->fetch_assoc()){
?>
<li>类别名称<input class="inp" value="<?php echo $row1['typename']?>" type="text" name="typename"></li>
<li>排 序<input value="<?php echo $row1['orderid']?>" class="inp" type="text" name="orderid"></li>
<li><input type="hidden" name="id" value="<?php echo $row1['id']?>">
<input class="btn" type="submit" name="dosub" value="修改"></li>
<?php
}
?>
</ul>
</form>
</body>
</html>修改新增分類頁面有個回顯功能,同時回顯之後由於不知道是對應的哪個id需要加入一個隱藏域進行處理:


新建檔案
<?php
echo "类别修改功能";
預覽
Clear
- 課程推薦
- 課件下載
課件暫不提供下載,工作人員正在整理中,後期請多關注該課程~ 















