<html> <head> <title></title> <meta charset="utf-8"> </head> <body> <p><a href='view.php'>ดูข้อความ</a></p> <form action="data.php" method="post"> <label>ชื่อ :</label> <input type="text" name="name"> <br> <label>ข้อความ :</label> <textarea name="message"></textarea> <br> <input type="submit" value="SAVE"> </form> </body> </html>
<?php include("connect.php") ?> <html> <head> <title>view</title> <meta charset="utf-8"> </head> <body> <p><a href='index.php'>เพิ่มข้อความ</a></p> <table border="1" width="100%"> <thead> <tr> <th>Name</th> <th>Message</th> <th>Time</th> </tr> </thead> <tbody> <?php $sql = mysql_query("SELECT * FROM message ORDER BY id ASC"); while($row = mysql_fetch_assoc($sql)){ echo "<tr>"; echo "<td>" .$row['name']. "</td>"; echo "<td>" .$row['message']. "</td>"; echo "<td>" .$row['time']. "</td>"; echo "</tr>"; } ?> </tbody> </table> </body> </html>
<meta charset="utf-8"> <?php include("connect.php"); $name = $_POST['name']; $message = $_POST['message']; $insertData = mysql_query("INSERT INTO message (name,message) VALUES ('".$name."','".$message."')"); if($insertData){ echo "บันทึกข้อมูลเรียบร้อย<br>"; echo "<a href='index.php'>ย้อนกลับ</a>"; }else{ echo "ผิดพลาดในการบันทึกข้อมูล ".mysql_error(); } ?>
<?php $username = "root"; $password = "root"; $host = "localhost"; $db = "message"; mysql_connect($host, $username, $password)or die(mysql_error()); mysql_select_db($db)or die(mysql_error()); mysql_query("SET NAMES UTF8"); ?>
-- phpMyAdmin SQL Dump -- version 4.1.12 -- http://www.phpmyadmin.net -- -- Host: localhost:3306 -- Generation Time: Aug 03, 2014 at 03:59 PM -- Server version: 5.5.34 -- PHP Version: 5.5.10 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; -- -- Database: `message` -- -- -------------------------------------------------------- -- -- Table structure for table `message` -- CREATE TABLE `message` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) DEFAULT NULL, `message` text, `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง