PHP? ??? ?? ??, ?? ? ?? ??? ?? ??? ?? ?? ?? ???? ?????.
? ????? ?? ??? ???? ???? "? ?? ??" ????? "??" ? "??" ??? ???? ??? ?????.
?? "??" ??? ?? ????????.
?? ????? ??? ????.
??? ?? ID? ?????
SQL ?? ?? ? ?? ID? ???? ???????? ? ID? ?? ??? ?????.
<?php $SQL ="DELETE FROM yx_books where id='".$_GET['id']."'"; $arry=mysqli_query($link,$sql); if($arry){ echo "<script> alert('刪除成功');location='list.php';</script>"; } else echo "刪除失敗"; ?>
? ???? "??" ??? ????.
??? ??? ??? ID? ?????
SQL ?? ?? ??????? ?? ?? ID? ?? ??? ?????. ?? ?? SQL ?? ?? ? ID? ??? ?????.
<?php $SQL = "SELECT * FROM yx_books where id='".$_GET['id']."'"; $arr=mysqli_query($link,$sql); $rows=mysqli_fetch_row($arr); ?> <?php if($_POST['action']=="modify"){ $sqlstr = "UPDATE yx_books SET name = '".$_POST['name']."', price = '".$_POST['price']."', uploadtime = '".$_POST['uptime']."', type = '".$_POST['type']."', total = '".$_POST['total']."' where id='".$_GET['id']."'"; $arry=mysqli_query($link,$sqlstr); if ($arry){ echo "<script> alert('修改成功');location='list.php';</script>"; } else{ echo "<script>alert('修改失敗');history.go(-1);</script>"; } } ?>
<from> ??? onSubmit ?? ???? ?????.
<form id="myform" name="myform" method="post" action="" onSubmit="return myform_Validator(this)">
onSubmit ?? ???? ???? <javascript>? ?????. ? ??? ???? ????. ??? ?? ????.
<script type="text/javascript"> function myform_Validator(theForm) { if (theForm.name.value == "") { alert("請輸入書名。"); theForm.name.focus(); return (false); } if (theForm.price.value == "") { alert("請輸入書名價格。"); theForm.price.focus(); return (false); } if (theForm.type.value == "") { alert("請輸入書名所屬類別。"); theForm.type.focus(); return (false); } return (true); } </script>