<? include( "../config.php"); if($_GET["Action"] == "Save") { //*** Insert Reply ***// $strSQL = "INSERT INTO reply "; $strSQL .="(QuestionID,CreateDate,Details,Name) "; $strSQL .="VALUES "; $strSQL .="('".$_GET["QuestionID"]."','".date("Y-m-d H:i:s")."','".$_POST["txtDetails"]."','".$_POST["txtName"]."') "; $objQuery = mysql_query($strSQL); //*** Update Reply ***// $strSQL = "UPDATE webboard "; $strSQL .="SET Reply = Reply + 1 WHERE QuestionID = '".$_GET["QuestionID"]."' "; $objQuery = mysql_query($strSQL); } //*** Delete Condition ***// if($_GET["Action"] == "Del") { $strSQL = "DELETE FROM reply "; $strSQL .="WHERE ReplyID = '".$_GET["ReplyID"]."' "; $objQuery = mysql_query($strSQL); if(!$objQuery) { echo "Error Delete [".mysql_error()."]"; } //header("location:$_SERVER[PHP_SELF]"); //exit(); } //*** Select Question ***// $strSQL = "SELECT * FROM webboard WHERE QuestionID = '".$_GET["QuestionID"]."' "; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $objResult = mysql_fetch_array($objQuery); //*** Update View ***// $strSQL = "UPDATE webboard "; $strSQL .="SET View = View + 1 WHERE QuestionID = '".$_GET["QuestionID"]."' "; $objQuery = mysql_query($strSQL); $strSQL2 = "SELECT * FROM reply WHERE QuestionID = '".$_GET["QuestionID"]."' ORDER BY CreateDate "; $objQuery2 = mysql_query($strSQL2) or die ("Error Query [".$strSQL."]"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Admin</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> <!-- body { background-color: #CCCCCC; } a:link { color: #FF9900; text-decoration: none; } a:visited { color: #FF6633; text-decoration: none; } a:hover { color: #FFCC66; text-decoration: none; } a:active { color: #FF9900; text-decoration: none; } .style1 { color: #660000; font-weight: bold; } .style4 {color: #660000} .style5 { color: #FF6633; font-weight: bold; } --> </style></head> <body> <form action="Viewwebboard_Admin.php?QuestionID=<?=$_GET["QuestionID"];?>&Action=Save" method="post" name="frmMain" id="frmMain"> <table width="1000" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td colspan="4"><img src="../images/aaa.jpg" width="228" height="105" /> </td> </tr> <tr> <td width="236" bgcolor="#666666"> </td> <td width="183" bgcolor="#666666"> </td> <td width="376" bgcolor="#666666"> </td> <td width="193" bgcolor="#666666"> </td> </tr> <tr> <td colspan="4" bgcolor="#FFFFFF"> <div align="center" class="style1">ตอบคำถามเว็บบอร์ด</div> <tr> <th scope="row"> </th> <td colspan="4"><table width="560" border="0" cellpadding="0" cellspacing="0" bgcolor="#FF9966"> <tr> <td colspan="4" bgcolor="#FF9966" align="center"><?=$objResult["Question"];?> </td> </tr> <tr> <td height="53" colspan="4" bgcolor="#FFFFCC"><div align="left"><span class="style4"> <?=$objResult["Details"];?> </span></div></td> </tr> <tr> <td width="142" bgcolor="#FDDFA5"><span class="style4"> ชื่อ : <?=$objResult["Name"];?> </span></td> <td width="261" bgcolor="#FDDFA5"><span class="style4"> วันที่สร้าง : <?=$objResult["CreateDate"];?> </span></td> <td width="70" bgcolor="#FDDFA5"> </td> <td width="87" bgcolor="#FDDFA5"> </td> </tr> </table></td> </tr> <tr> <th scope="row"> </th> <td></td> <td> </td> <td> </td> <td width="2"> </td> </tr> <? $intRows = 0; while($objResult2 = mysql_fetch_array($objQuery2)) { $intRows++; ?> <tr> <th scope="row"> </th> <td colspan="3" rowspan="3" bgcolor="#FFFFFF"><span class="style5">No : <?=$intRows;?> </span> <table width="563" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFCCFF"> <tr> <td height="53" colspan="3" bgcolor="#FCFCF2"><span class="style4"> <?=nl2br($objResult2["Details"]);?> </span></td> </tr> <tr> <td width="104" bgcolor="#FDDFA5"><span class="style4">ชื่อ : <?=$objResult2["Name"];?> </span></td> <td width="196" bgcolor="#FDDFA5"><span class="style4">วันที่สร้าง : <?=$objResult2["CreateDate"];?> </span></td> <td width="282" bgcolor="#FDDFA5"><a href="JavaScript:if(confirm('ยืนยันการลบข้อมูล?')==true){window.location='Viewwebboard_Admin.php?Action=Del&ReplyID=<?=$objResult2["ReplyID"];?>';}"><img src="../images/Delete.jpg" width="18" height="18" /></a></td> </tr> </table> </td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <th scope="row"> </th> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <th scope="row"> </th> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <th scope="row"> </th> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <? } ?> <tr> <th scope="row"> </th> <td colspan="3" rowspan="6"> <table width="561" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#FFFFCC"> <tr> <td width="75">รายละเอียด</td> <td><div align="left"><span class="style4"> <textarea name="txtDetails" cols="50" rows="5" id="txtDetails"></textarea> </span></div></td> </tr> <tr> <td width="75"> </td> <td width="486"> </td> </tr> <tr> <td>ชื่อ</td> <td><input name="txtName" type="text" id="txtName" value="ADMIN" size="50" readonly="ADMIN"/></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><input name="btnSave" type="submit" id="btnSave" value="Submit" /></td> </tr> </table> </td> <td> </td> </tr> <tr> <th scope="row"> </th> <td> </td> </tr> <tr> <th scope="row"> </th> <td> </td> </tr> <tr> <th scope="row"> </th> <td> </td> </tr> <tr> <th scope="row"> </th> <td> </td> </tr> <tr> <th scope="row"> </th> <td> </td> </tr> <tr> <th scope="row"> </th> <td> </td> <td><div align="left"><a href="../admin/manage_webboard.php"><img src="../images/Back.png" width="15" height="15" />กลับไปหน้าจัดการเว็บบอร์ด</a></div></td> <td> </td> <td> </td> </tr> </table> </form> </body> </html>
Quote:เพิ่มลงในโค้ดครับ <td width="282" bgcolor="#FDDFA5"> <a href="JavaScript:if(confirm('ยืนยันการลบข้อมูล?')==true) {window.location='Viewwebboard_Admin.php?Action=Del&ReplyID=<?=$objResult2["ReplyID"];?>&QuestionID=<?=$_GET["QuestionID"];?>';}"> <img src="../images/Delete.jpg" width="18" height="18" /> </a> </td>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง