<?php include_once"../connect.php"; //find faculty $branch = mysql_query("SELECT * FROM branch"); //find teach edit if (!empty($_GET['teach_id'])) { $rs = mysql_query("SELECT * FROM teacher WHERE teach_id=$_GET[teach_id]"); $r = mysql_fetch_assoc($rs); } ?> <fieldset> <legend>จัดการข้อมูลอาจารย์</legend> <form action="teacher_save.php" method="post"> <table border="0" cellspacing="2" cellpadding="1"> <tr> <td>เลือกสาขา</td> <td> <select name="branch_id"> <? while ($branch_view = mysql_fetch_assoc($branch)) { ?> <option value="<?= $branch_view['branch_id']; ?>"><?= $branch_view['branch_name']; ?></option> <? } ?> </select> </td> </tr> <tr> <td>ชื่ออาจารย์</td> <td><input type="text" name="teach_name" value="<?= $r['teach_name']; ?>"></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="บันทึกข้อมูล" <input type="heddin" name="teach_id" value="<?=$r['teach_id'];?>"></td> </tr> </table> </form> </fieldset> <fieldset> <legend>รายชื่ออาจารย์ทั้งหมด</legend> <table border="0" cellspacing="1" cellpadding="2"> <thead> <tr bgcolor="#cccccc"> <td>ลำดับ</td> <td>ชื่ออาจารย์</td> <td>สาขา</td> <td>คณะ</td> <td>แก้ไข</td> <td>ลบ</td> </tr> </thead> <tbody> <?php $teach = "SELECT teach_id,teacher.teach_name,branch.branch_name,faculty.faculty_name FROM teacher INNER JOIN branch ON (teacher.branch_id = branch.branch_id) INNER JOIN faculty ON (branch.faculty_id = faculty.faculty_id)"; $result = mysql_query($teach); while ($teach_view = mysql_fetch_array($result)) { if ($bg == "#eeeeee") { //ส่วนของการ สลับสี $bg = "#ffffe0"; } else { $bg = "#eeeeee"; } ?> <tr bgcolor="<?= $bg; ?>"> <td><?= ++$n; ?></td> <td><?= $teach_view['teach_name']; ?></td> <td><?= $teach_view['branch_name']; ?></td> <td><?= $teach_view['faculty_name']; ?></td> <td align="center"> <a href="_main.php?url=teacher.php&teach_id=<?=$teach_view['teach_id'];?>"> <img src="pic/edit.png" width="16" height="16"> </a> </td> <td align="center"><img src="pic/delete.png" width="16" height="16"></td> </tr> <? } ?> </tbody> </table> </fieldset>
<html> <head> <title>ThaiCreate.Com Tutorial</title> </head> <? $strDefault = "C003"; mysql_connect("localhost","root","root") or die(mysql_error()); mysql_select_db("mydatabase"); ?> <body> <form action="phpLlistmenuDatebase2.php" method="post" name="form1"> List Menu<br> <select name="lmName1"> <option value=""><-- Please Select Item --></option> <? $strSQL = "SELECT * FROM customer ORDER BY CustomerID ASC"; $objQuery = mysql_query($strSQL); while($objResuut = mysql_fetch_array($objQuery)) { if($strDefault == $objResuut["CustomerID"]) { $sel = "selected"; } else { $sel = ""; } ?> <option value="<?=$objResuut["CustomerID"];?>" <?=$sel;?>><?=$objResuut["CustomerID"]." - ".$objResuut["Name"];?></option> <? } ?> </select> <input name="btnSubmit" type="submit" value="Submit"> </form> </body> </html> <? mysql_close(); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง