PHP ?? ?? ??? ??? ?? ?? ???
new_ed.php ??? ?????
? ??? ?? ?? ???? ?? ? ?? ??? ? ? ????. ?? ???? ?? ??? ????????.
???? ??? ??? ????<?php header("content-type:text/html;charset=utf8"); $id=$_GET['id']; $conn=mysqli_connect("localhost","root","root","News"); mysqli_set_charset($conn,"utf8"); if($conn){ $sql="select * from new where id='$id'"; $que=mysqli_query($conn,$sql); $row=mysqli_fetch_assoc($que); } ?>The ?? ??? ???????? ???? ?? ? ??? ???, ???? ?? ??? ????? ?? ??? ???? ??? ???. ?? ?? ??? ?? ?? ??? ????? ?? ??? ????? ???. ? ????? ??? ??? ???? ? ? ???, ?? ????? HTML? PHP ??? ???? ???. new_ed.php ??? ?? ??
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PHP中文網(wǎng)</title>
<style>
body{
background-color: rgba(128, 128, 128, 0.3);
}
</style>
<script>
function foo(){
if(myform.title.value==""){
alert('請?zhí)顚懩愕男侣剺?biāo)題');
myform.title.focus();
return false;
}
if(myform.content.value==""){
alert('新聞內(nèi)容不能為空哦');
myform.content.focus();
return false;
}
}
</script>
</head>
<body>
<?php
header("content-type:text/html;charset=utf8");
$id=$_GET['id'];
$conn=mysqli_connect("localhost","root","root","News");
mysqli_set_charset($conn,"utf8");
if($conn){
$sql="select * from new where id='$id'";
$que=mysqli_query($conn,$sql);
$row=mysqli_fetch_assoc($que);
}
?>
<form method="post" action="new_upd.php?id=<?php echo $row['id'] ?>" onsubmit=" return foo();" name="myform">
<h1>修改新聞</h1><span><a href="new_list.php">返回</a></span>
<p>標(biāo)題:<input type="text" name="title" value="<?php echo $row['title']?>"></p>
<p>內(nèi)容:<textarea cols=30 rows=5 name="content"><?php echo $row['content']?></textarea></p>
<p><button>修改</button></p>
</form>
</body>
</html>
?? ??? ???? new_upd.php ???? ???? ? ???? new_upd.php ???? ??????? ???? ????