<? if($_GET["Action"] == "Save") { include "include/connect.inc.php"; //*** Insert Question ***// $sql = "INSERT INTO webboard "; $sql .="(CreateDate,Question,Details,mem_user) "; $sql .="VALUES "; $sql .="('".date("Y-m-d H:i:s")."','".$_POST["txtQuestion"]."','".$_POST["txtDetails"]."','".$_POST["mem_user"]."') "; $query = mysql_query($sql); if(trim($_POST["txtQuestion"]) == "") { echo"<body onload=\"window.alert('กรุณากรอกคำถามด้วยค่ะ'); return history.back();\">"; exit(); } if(trim($_POST["txtDetails"]) == "") { echo"<body onload=\"window.alert('กรุณากรอกรายละเอียดด้วยค่ะ'); return history.back();\">"; exit(); } if(trim($_POST["mem_user"]) == "") { echo"<body onload=\"window.alert('กรุณากรอกชื่อด้วยค่ะ'); return history.back();\">"; exit(); } //header("location:Webboard.php"); echo "<meta http-equiv='refresh' content='0; url=index.php?Category=Webboard'>"; } ?> <form method="POST" action="index.php?Category=NewQuestion&Action=Save" enctype="multipart/form-data" name="add" > <table width="621" border="0" cellpadding="4" cellspacing="4"> <tr> <td>คำถาม</td> <td><input name="txtQuestion" type="text" id="txtQuestion" value="" size="70"></td> </tr> <tr> <td width="78">รายละเอียด</td> <td><textarea name="txtDetails" cols="50" rows="5" id="txtDetails"></textarea></td> </tr> <tr> <td width="78">ชื่อ</td> <td width="647"><input name="mem_user" type="text" id="mem_user" value="" size="50"></td> </tr> </table> <input name="Save" type="submit" id="Save" value="Submit"> </form>
<br> <div align="center"><font color='red' size = 30><strong>WEBBOARD </font><br> หากมีปัญหาหรือข้อคิดเห็นใดๆสามารถแจ้งได้ที่นี่ </strong> </div> <div align="left"> <a href="index.php?Category=NewQuestion"><img src="icon/up.gif" width="16" height="16">[<strong>คำถามใหม่</strong></a> ] <? include "include/connect.inc.php"; $sql = "SELECT * FROM webboard "; $query = mysql_query($sql); $Num_Rows = mysql_num_rows($query); $Per_Page = 10; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $sql .=" order by QuestionID DESC LIMIT $Page_Start , $Per_Page"; ?> </div> <table width="80%" align="center" leftmargin="0" rightmargin="0" border="0" cellpadding="2" cellspacing="2" bgcolor="#66FF99"> <tr> <th width="7%"> <div align="center">QuestionID</div></th> <th width="35%"> <div align="center">Question</div></th> <th width="15%"> <div align="center">Name</div></th> <th width="15%"> <div align="center">CreateDate</div></th> <th width="5%"> <div align="center">View</div></th> <th width="5%"> <div align="center">Reply</div></th> </tr> <? $i=0; while($row = mysql_fetch_array($query)) { $i++; if($i%2==0) { $bg = "#A8FFCB"; } else { $bg = "#CEFFE1"; } ?> <tr bgcolor="<?=$bg;?>"> <td><div align="center"><?=$row["QuestionID"];?></div></td> <td><a href="index.php?Category=ViewWebboard&QuestionID=<?=$row["QuestionID"];?>"><?=$row["Question"];?></a></td> <td><?=$row["mem_user"];?></td> <td><div align="center"><?=$row["CreateDate"];?></div></td> <td><div align="center"><?=$row["View"];?></td> <td><div align="center"><?=$row["Reply"];?></td> </tr> <? } ?> </table> <br> Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> "; } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง