The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.
Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by arsan.kp2, 2022-10-17 06:10:04

0000000000000000000000000000000000

0000000000000000000000000000000000

11-4 ไฟล์ dbconnect.php

1 <?
2 $host=”localhost”;
3 $username=”root”;
4 $pass_word=”1234”;
5 $db=”db_activity”;

6 mysql_connect($host,$username,$pass_word) or die
(“ไมส่ ามารถติดต่อฐานขอ้ มลู ไดค้ ะ่ ”);

7 mysql_select_db($db) or die
(“ไม่สามารถเปิ ดฐานขอ้ มูลไดค้ ะ่ ”);
8 mysql_query(‘SET NAMES tis620’);

9 ?>

11-5 ไฟล์ page.php

1 <HTML>
2 <HEAD><TITLE>ระบบจดั การเอกสาร SAR แผนกวชิ าคอมพิวเตอร์</TITLE>
3 <meta http-equiv=”Content-Type” content=”text/html; charset=tis620”>
4 <link rel=”stylesheet” href=”formt.css” type=”text/css”>

5 </HEAD>

6 <BODY>
7 <? include “main.php”; ?>

8 <p>
9 <TABLE width=”25%” border=”0” align=”center” cellspacing=”0”>

10 <TR >
11 <TD colspan=”2” align=”certer” bgcolor=”#000099”><font

color=”#FFFFFF”>ระบบจดั การเอกสาร
SAR</br>แผนกวชิ าคอมพิวเตอร์ธุรกจิ </font></TD>

12 </TR>

13 <TR>
14 <TD width=”20%” align=”right” bgcolor=”#D9D9FF”><IMG

SRC=”go.gif”></TD>
15 <TD bgcolor=”#D9D9FF”><a href=”[age1.php”>เพ่มิ ขอ้ มลู </a></TD>

16 </TR>

17 <TR>
18 <TD width=”20%” align=”right” bgcolor=”#BFBFFF”><IMG

SRC=”go.gif”></TD>
19 <TD bgcolor=”#BFBFFF”><a href=”[age2.php”>คน้ หา & แกข้ อ้ มลู </a></TD>

20 </TD>

21 <TR>
22 <TD width=”20%” align=”rigth” bgcolor=”#D9D9FF”><IMG

SRC=”go.gif”></TD>
23 <TD bgcolor=”#D9D9FF”><a href=:page3.php”>คน้ หา & ลบขอ้ มลู </a>

24 </TD>

25 </TR>

26 <TR>
27 <TD width=”20%” aligth=”right” bgcolor=”#BFBFFF”><IMG

SRC=”go.gif”></TD>
<TD bgcolor=”#BFBFFF”><a href=”page4.php”>แสดงขอ้ มูล</a></TD>

28 </TR>

29 <TR>
30 <TD width=”20%” align=”right” bgcolor=”#D9D9FF”><IMG

SRC=”go.gif”></TD>

31 <TD bgcolor=”#D9D9FF”><a href=”index.php”>ออกจากระบบ</a></TD>

32 </TR>
33 <TR>
34 <TD colspan=”2” bgcolor=”#000099” align=”center”><font

color=”#FFFFFF”>คลิกเลอื กรายการ </font></TD>

35 </TR>
36 </TABLE>
37 </BODY>
38 </HTML>

11-6 ไฟล์ page1.php

1 <HTML>
2 <HEAD><TITLE>ระบบจดั การเอกสาร SAR แผนกวิชาคอมพิวเตอร์ธุรกิจ</TITLE>
3 <meta http-equiv=”content-Type” content=”text/html; charset=tis620”>
4 <link rel=”stylesheet” href=”format.css” type=”text/css”>
5 </HEAD>
6 <BODY>
7 <? include “main.php”; ?>
8 <p>
9 <TABLE width=”25%” border=”0” align=”center” cellspacing=”0”>
10 <TR>

11 <TD colspan=”3” align=”center” bgcolor=”#000099”><font
color=”#FFFFFF”>ระบบจดั การเอกสาร
SAR</br>แผนกวชิ าคอมพิวเตอร์ธุรกจิ </font></TD>

12 </TR>
13 <TR>
14 <TD width=”20%” align=”right” bgcolor=”#D9D9FF” ><IMG

SRC=”go.gif></TD>
15 <TD bgcolor=”#D9D9FF”><a

href=”add_tea.php”>เพมิ่ ขอ้ มลู ครู</a><TD>

16 </TR>
17 <TR>
18 <TD width=”20%” align=”right” bgcolor=”#BFBFFF”><IMG

SRC=”go.gif”></TD>
19 TD bgcolor=”#BFBFFF”><a

href=”add_stan.php”>เพ่ิมขอ้ มูลมาตรฐาน</a></TD>

20 </TR>
21 <TR>
22 <TD width=”20%” align=”right” bgcolor=”#D9D9FF” ><IMG

SRC=”go.gif></TD>
23 <TD bgcolor=”#D9D9FF”><a

href=”add_stan.php”>เพิม่ ขอ้ มลู เอกสาร</a><?TD>

24 </TR>
25 <TD width=”20%” align=”right” bgcolor=”#D9D9FF” ><IMG

SRC=”go.gif></TD>
26 <TD bgcolor=”#D9D9FF”><a href=”page.php”>กลบั เมนูหลกั </a></TD>

27 </TR>
28 <TR>
29 <TD colspan=”2” bgcolor=”#000099” align=”center”><font

color=”#FFFFFF”>คลกิ เลอื กรายการ</font></TD>

30 </TR>
31 </TABLE>
32 </BODY>
33 </HTML>

11-7 ไฟล์ page1.php

1 <HTML>
2 <HEAD>
3 <TITLE>ฟอร์มบนั ทกึ ขอ้ มูลครู</TITLE>

4 </HEAD>
5 <BODY>
6 <? include “main.php”; ?>
7 <p>
8 <TABLE width=”60%”>
9 <TR>
10 <TD width=”20%”>&nbsp;</TD>
11 <TD>
12 <FORM METHOD=POST ACTION= “add1_tea.php”>
13 <table width=”495” border=”0”
14 <tr>
15 <td width=”111”><div align=”>คานาชื่อ : </div></td>
16 <td width=”374”><SELECT NAME=”tea_sex”>
17 <OPTION VALUE=”นาย” SElECTED>นาย
18 <OPTION VALUE=”นาง”>นาง
19 <OPTION VALUE=”นางสาว”>นางสาว

20 </SELECT></td>
21 </tr>
22 <tr>
23 <td><div align=”right”>ชื่อ : </div></td>
24 <td> <INPUT TYPE=”text” NAME=”tea_fname” size=”60”></td>
25 </tr>
26 <tr>
27 <td><div align=”right”>นามสกลุ :</div></td>
28 <td> <INPUT TYPE=”text” NAME=”tea_lname” size=”60”></td>
29 </tr>
30 <tr>
31 <td><div align=”right”>ตาแหน่ง : </div></td>
32 <td> <SELECT NAME=”tea_position”>
33 <OPTION VALUE=”หวั หนา้ แผนก” SELECTED>หวั หนา้ แผนก
34 <OPTION VALUE=”แนะแนว”>แนะแนว
35 <OPTION VALUE=”พสั ดุ”>พสั ดุ
36 <OPTION VALUE=”ธุรการ”>ธุรการ
37 <OPTION VALUE=”กิจกรรม”>กิจกรรม

38 </SELECT></td>
39 </tr>
40 <tr>
41 <td><div align=”right”></div></td>
42 <td> <INPUT TYPE=”submit” value=”บนั ทึก”> <INPUT TYPE=”reset” value=”ยกเลกิ ”></td>

43 </tr>
44 </table>

45 </FORM>

46 <p>
47 <A HREF=’page1.php’>กลบั หน้าหลกั </A>

48 <p>

49 <?
50 echo “<table width=’80%’ border=’1’>”;
51 echo “<tr><td align=’center’ width=’10%’>”;
52 echo “รหสั ”;
53 echo “</td><td align=’center’ width=’40%’>”;
54 echo “ช่ือ – สกุล”;
55 echo “</td><td align=’center’ width=’20%’>”;
56 echo “ตาแหน่ง”;
57 echo “</td><tr></table>”;
58 include(“dbconnect.php”);
59 $tb=”tb_teacher”;
60 $result=mysql_query(“SELECT * FROM $tb”);

61 while($row=mysql_fetch_array($result))

62 {
63 echo “<teble width=’80%’ border=’1’>”;
64 echo “<tr><td align=’center’ width=’10%”;
65 echo $row[‘tea_id’];
66 echo “</td><td width=’40%’>”;
67 echo $row[‘tea_sex’];
68 echo $row[‘tea_fname’];
69 echo “&nbsp;&nbsp;”;
70 echo $row[‘tea_lname’];
71 echo “</td><td width=’20%’>”;
72 echo $row[‘tea_position’];
73 echo “</tr></table>”;

74 }

75 mysql_close();

76 ?>

77 </TD><TD>&nbsp;</TD>

78 </TR>

79 </TABLE>

80 </BODY>

81 </HTML>

11-8 ไฟล์ add1_tea.php

1 <HTML>

2 <HEAD>
3 <TITLE>บนั ทึกเพมิ่ ขอ้ มลู ครูลงในตาราง</TITLE>

4 </HEAD>

5 <BODY>

6 <?
7 if($tea_fname==””or $tea_lname==””)

8{
9 echo “<script>”;
10 echo “alert(‘ Error : กรุณากรอกขอ้ มูลใหค้ รบนะคะ’);”;
11 echo “</script>”;
12 echo “<meta http-equiv=refresh content=0;url=add_tea.php>”;

13 exit;

14 }

15 include(“dbconnect.php”);
16 $tb=”tb_teacher”;
17 mysql_query(“INSERT INTO $tb(tea_id,tea_sex,tea_fname,tea_lname,tea_position)

values(‘’,’$tea_sex’,’$tea_fname’,’$tea_lname’,’$tea_position’)”) or die (“ADD ขอ้ มูลลง
Table ไมไ่ ด”้ );
18 echo “<script>”;
19 echo “alert(‘ขอ้ มลู เอกสารถกู บนั ทึกเรียบร้อยแลว้ ’);”;
20 echo “</script>”;
21 echo “<meta http-equiv=refresh content=0;url=page1.php>”;
22 ?>

23 <BODY>
24 </HTML>

11-9 ไฟล์ add_stan.php

1 <HTML>
2 <HEAD>
3 <TITLE> ฟอร์มบนั ทึกมาตรฐานและตวั บง่ ช้ี </TITLE>

4 </HEAD>
5 <BODY>
6 <? include “main.php”; ?>

7 <p>
8 <TABLE width=”60%”>
9 <TR>
10 <TD width=”20%”>&nbsp;</TD>

11 <TD>
12 <FORM METHOD=POST ACTION=”add1_stan.php”>
13 <table width=”760” border=”0”>
14 <tr>
15 <td width=”133”><div align=”right”>มาตรฐานท่ี : </div></td>
16 <td width=”611”><INPUT TYPE=”text” NAME=”stan_id” size=”10”></td>
17 </tr>
18 <tr>
19 <td><div align=”right”>ช่ือมาตรฐาน :</div></td>
20 <td><INPUT TYPE=”text” NAME=”stan_name” size=”100”></td>
21 </tr>
22 <tr>
23 <td><div align=”right”>ครูที่รับผดิ ชอบ : </div></td>
24 <td><SELECT NAME=”ref_tea_id”>
25 <OPTION VALUE=”0”>เลอื กช่ือครู </OPTION>

26 <?
27 include “dbconnect.php”;
28 $sql= “select * from tb_teacher”;
29 $result=mysql_db_query($db,$sql);

30 while($row=mysql_fetch_array($result)) {
31 $tea_id=$row[tea_id];
32 $tea_fname=$row[tea_fname];
33 $tea_lname=$row[tea_lname];
34 echo “<OPTION VALUE=’$tea_id’>$tea_fname $tea_lname</OPTION>”;
35 }
36 ?>
37 </SELECT></td>

38 </tr>

39 <tr>
40 <td>&nbsp;</td>
41 <td><INPUT TYPE=”submit” name=”submit” value=”บนั ทกึ ”> <INPUT TYPE=”reset”

name=”reset”
value=”ยกเลิก”></td>

42 </tr>

43 </table>
44 </FORM><p>
45 <A HREF=’page1.php’>กลบั หนา้ หลกั </A><p>

46 <?
47 echo “<table width=’80%’ border=’1’>”;
48 echo “<tr><td align=’center’ width=’10%’>”;
49 echo “ตวั บ่งช้ี”;
50 echo “</td><td align=’center’ width=’40%’>”;
51 echo “ชื่อมาตรฐานตวั บง่ ช้ี”;
52 echo “</td><td align=’center’ width=’30%’>”;
53 echo “ครูทรี่ บั ผดิ ชอบ”;
54 echo “</td></tr></table>”;
55 include(“dbconnect.php”);
56 $result1=mysql_query(“select

tb_standard.stan_id,tb_standard.stan_name,tb_teacher.tea_sex,
tb_teacher.tea_fname,tb_teacher.tea_l

name FROM tb_teacher Inner Join tb_standard ON tb_teacher.tea_id = tb_
standard.tea_id”);
57 while($row1=mysql_fetch_array($result1))
58 {
59 echo “<table width=’80%’ border=’1’>”;
60 echo “<tr><td align=’center’ width=’10%’>”;
61 echo $row1[‘stan_id’];
62 echo “</td><td width=’40%’>”;
63 echo $row1[‘stan_name’];
64 echo “</td><td width=’30%’>”;
65 echo $row1[‘tea_sex’]. $row1[‘tea_fname’]. ‘&nbsp;&nbsp;’.$row1[tea_lname’];
66 echo “</tr></table>”;

67 }
68 mysql_close();
69 ?>
70 </TD>

71 <TD>&nbsp;</TD>
72 </TR>

73 </TABLE>
74 </BODY>

75 </HTML

11-10ไฟล์ add1_stan.php

1 <HTML>
2 <HEAD>
3 <TITLE> บนั ทกึ เพ่ิมขอ้ มลู มาตรฐาน</TITLE>

4 </HEAD>
5 <BODY>
6 <?
7 include(“dbconnect.php”);

8 $tb=”tb_standard”;
9 if($stan_id==”” or $stan_name==””) {
10 echo “<script>”;
11 echo “alert(‘error กรอกขอ้ มูลไม่ครบ’);”;

12 echo “</script>”;
13 echo “<meta http-equiv=refresh content=0;url=add_stan.php>”;

14 exit;

15 }
16 $sql=”select * from $tb where stan_id=’$stan_id’ “;

17 $result=mysql_db_query($db,$sql);

18 $num=mysql_num_rows($result);

19 if($num>0) {
20 echo “<script>”;
21 echo “alert(กรอกขอ้ มลู ใหม่รหสั มาตรฐานซ้าคะ่ ’);”;
22 echo “</script>”;
23 echo “<meta http-rquiv=refresh content=0;url=add_stan.php>”;

24 exit;

25 }
26 mysql_query(“insert into $tb(stan_id,stan_name,tea_id) values(‘$stan_id‘,’$stan_

name’,’$ref_tea_id’)”) or
die (“Add ขอ้ มูลลงฐานขอ้ มลู ไมไ่ ด”้ );

27 echo “<script>”;
28 echo “alert(‘บนั ทึกขอ้ มูลเสร็จเรียบรอ้ ยแลว้ ’);”;

29 echo “</script>”;
30 echo “<meta http-rquiv=refresh content=0;url=add_stan.php>”;

31 ?>

32 </BODY>

33 </HTML>


Click to View FlipBook Version