<!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> Type </title> <meta http-equiv = "content-type" content = "text/html;charset=utf-8" /> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> </head> <body> <form action = "add_type.php" method = "get" align = "center"> status : <input type = "text" name = "status" /><br /> <input type = "submit" /> </form> <hr /> <?php include ('include/connectdb.php'); $pagesize = 3; $sql = "SELECT * FROM type ORDER BY type asc"; $result = mysql_query($sql) or die (mysql_error()); $total = mysql_num_rows($result); $totalpage = ceil($total/$pagesize); $page = $_REQUEST['page']; if(!isset($page)) { $goto = 0; $page = 1; } else { $goto = ($page - 1) * $pagesize; } $sql = "SELECT * FROM type ORDER BY type asc limit $goto,$pagesize"; $result = mysql_query($sql) or die (mysql_error()); ?> <table border = '1' align = 'center'> <?php while($row = mysql_fetch_array($result)) { ?> <tr> <td width = '70px' align = 'center'><?= $row['type'] ?></td> <td width = '120px' align = 'center'><?= $row['status'] ?></td> </tr> <?php } if($totalpage > 1) { for($i = 1;$i <= $totalpage;$i++) { if($i == $page) { echo "หน้า". $page; } else { echo "<a href = 'add_type_form.php?page=$i'>".$i."</a>"; } } } ?> </td> </tr> </table> </body> </html> File add_type.php CODE PHP <?php include ("include/connectdb.php"); if (empty($_REQUEST["status"])) { echo "คุณกรอกข้อมูลไม่ครบ"; } else { $status = $_REQUEST["status"]; $sql = "select * from type where status = '$status'"; $result = mysql_query($sql) or die (mysql_error()); $num = mysql_num_rows($result); if ($num > 0) { echo "มีข้อมูลอยู๋แล้ว"; } else { $sql = "INSERT INTO type (status) VALUES ('$status')"; $result = mysql_query($sql) or die (mysql_error()); if ($result) { echo "บันทึกข้อมูลเรียบร้อยแล้ว"; } else { echo "เกิดข้อมิดพลาด"; } } } echo "<br /><a href = 'add_type_form.php'>Back</a>"; ?> <!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> Type </title> <meta http-equiv = "content-type" content = "text/html;charset=utf-8" /> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> </head> <body> </body> </html>
<?php include('include/connectdb.php'); ?> <!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> member </title> <meta http-equiv = "content-type" content = "text/html;charset=utf-8" /> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> </head> <body> <form action = "add_member.php" method = "get"> รหัสนักศึกษา : <input type = "text" name = "id_stu" /><br /> ชื่อ : <input type = "text" name = "fname" /><br /> นามสลุล : <input type = "text" name = "lname" /><br /> อาชีพ : <select name = "job"> <option></option> <?php $sql = "select * from type"; $result = mysql_query($sql) or die (mysql_error()); while($row = mysql_fetch_array($result)) { ?>// ดึงข้อมูลจาก Database มาใส่ <option value = "<?=$row['type'] ?>"><?=$row['status']?></option> <?php } ?> <br /> <input type = "submit" /> </form> </body> </html> file add_member.php CODE PHP <?php include('include/connectdb.php'); if(empty($_REQUEST['id_stu']) || empty($_REQUEST['fname']) || empty($_REQUEST['lname']) || empty($_REQUEST['job'])) { echo "กรองข้อมูลไม่ครบ"; } else { $id_stu = $_REQUEST['id_stu']; $fname = $_REQUEST['fname']; $lname = $_REQUEST['lname']; $job = $_REQUEST['job']; $sql = "insert into member (id_stu,fname,lname,type) values ('$id_stu','$fname','$lname','$job')"; $result = mysql_query($sql) or die (mysql_error()); if ($result) { echo "บันทึกข้อมูลเรียบร้อยแล้ว"; } else { echo "เกิดข้อมิดพลาด"; } } ?> <!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> member </title> <meta http-equiv = "content-type" content = "text/html;charset=utf-8" /> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> </head> <body> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง