003.
<head><link rel=
"stylesheet"
type=
"text/css"
href=
"../css/style.css"
/>
004.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
005.
<title>Management System Of Buckram Collars Prodution</title>
006.
<style type=
"text/css"
>
007.
<!--
008.
body {
009.
background-color: #CFF;
010.
}
011.
a:hover {
012.
color: #06F;
013.
text-decoration: none;
014.
}
015.
#perple {
016.
color: #F6F;
017.
}
018.
a:link {
019.
text-decoration: none;
020.
}
021.
a:visited {
022.
text-decoration: none;
023.
}
024.
a:active {
025.
text-decoration: none;
026.
}
027.
#use2 {
028.
text-decoration: underline;
029.
}
030.
#blue {
031.
color: #0FF;
032.
}
033.
#white {
034.
color: #FFF;
035.
}
036.
#orenge {
037.
color: #FC0;
038.
}
039.
#useing {
040.
color: #FF2D2D;
041.
text-decoration: underline;
042.
}
043.
#green {
044.
color: #0F3;
045.
}
046.
body {
047.
background-color: #CFF;
048.
}
049.
div.scroll {
050.
height: 558px;
051.
width: 960px;
052.
overflow: auto;
053.
scrollbar-face-color:#FB7800;
054.
scrollbar-track-color:#FFE8EF;
055.
scrollbar-arrow-color:#F4346F;
056.
scrollbar-shadow-color:#F34077;
057.
scrollbar-dark-shadow-color:#F33771;
058.
scrollbar-highlight-color:#FFFFFF
059.
}
060.
</style>
061.
</head>
062.
063.
<body>
064.
<?
065.
$objConnect
= mysql_connect(
"localhost"
,
"root"
,
"1234"
)
or
die
(
"Error Connect to Database"
);
066.
$objDB
= mysql_select_db(
"pj001"
);
067.
068.
069.
if
(
$_POST
[
"hdnCmd"
] ==
"Add"
)
070.
{
071.
$strSQL
=
"INSERT INTO customer "
;
072.
$strSQL
.=
"(cus_brandname,cus_code,cus_name,cus_lname,cus_tel,cus_fax,cus_address,cus_email) "
;
073.
$strSQL
.=
"VALUES "
;
074.
$strSQL
.=
"('"
.
$_POST
[
"cus_edit_brandname"
].
"','"
.
$_POST
[
"cus_edit_id"
].
"' "
;
075.
$strSQL
.=
",'"
.
$_POST
[
"cus_edit_name"
].
"' "
;
076.
$strSQL
.=
",'"
.
$_POST
[
"cus_edit_lname"
].
"','"
.
$_POST
[
"cus_edit_tel"
].
"' "
;
077.
$strSQL
.=
",'"
.
$_POST
[
"cus_edit_fax"
].
"','"
.
$_POST
[
"cus_edit_address"
].
"','"
.
$_POST
[
"cus_edit_email"
].
"') "
;
078.
$objQuery
= mysql_query(
$strSQL
);
079.
if
(!
$objQuery
)
080.
{
081.
echo
"Error Save ["
.mysql_error().
"]"
;
082.
}
083.
084.
085.
}
086.
087.
088.
if
(
$_POST
[
"hdnCmd"
] ==
"Update"
)
089.
{
090.
$strSQL
=
"UPDATE customer SET "
;
091.
$strSQL
.=
"cus_brandname = '"
.
$_POST
[
"cus_edit_brandname"
].
"' "
;
092.
$strSQL
.=
",cus_code = '"
.
$_POST
[
"cus_edit_id"
].
"' "
;
093.
$strSQL
.=
",cus_name = '"
.
$_POST
[
"cus_edit_name"
].
"' "
;
094.
$strSQL
.=
",cus_lname = '"
.
$_POST
[
"cus_edit_lname"
].
"' "
;
095.
$strSQL
.=
",cus_tel = '"
.
$_POST
[
"cus_edit_tel"
].
"' "
;
096.
$strSQL
.=
",cus_fax = '"
.
$_POST
[
"cus_edit_fax"
].
"' "
;
097.
$strSQL
.=
",cus_address = '"
.
$_POST
[
"cus_edit_address"
].
"' "
;
098.
$strSQL
.=
",cus_email = '"
.
$_POST
[
"cus_edit_email"
].
"' "
;
099.
$strSQL
.=
"WHERE cus_code = '"
.
$_POST
[
"cus_edit_id"
].
"' "
;
100.
$objQuery
= mysql_query(
$strSQL
);
101.
if
(!
$objQuery
)
102.
{
103.
echo
"Error Update ["
.mysql_error().
"]"
;
104.
}
105.
106.
107.
}
108.
109.
110.
if
(
$_GET
[
"Action"
] ==
"Del"
)
111.
{
112.
$strSQL
=
"DELETE FROM customer "
;
113.
$strSQL
.=
"WHERE cus_code = '"
.
$_GET
[
"CusID"
].
"' "
;
114.
$objQuery
= mysql_query(
$strSQL
);
115.
if
(!
$objQuery
)
116.
{
117.
echo
"Error Delete ["
.mysql_error().
"]"
;
118.
}
119.
120.
121.
}
122.
123.
124.
$strSQL
=
"SELECT * FROM customer"
;
125.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
126.
?>
127.
<form name=
"frmMain"
method=
"post"
action=
"<?=$_SERVER["
PHP_SELF
"];?>"
>
128.
<input type=
"hidden"
name=
"hdnCmd"
value=
""
>
129.
130.
<div id=
"wrapper"
>
131.
<div id=
"header"
></div>
132.
<div id=
"line_header"
></div>
133.
<div id=
"line_underheader"
></div>
134.
<div id=
"lift_menubutton"
></div>
135.
<div id=
"button1"
><a id=
"use2"
>งานทะเบียน</a></div>
136.
<div id=
"button2"
><a href=
"../Document/doc_cut1.php"
id=
"green"
>งานเอกสาร</a></div>
137.
<div id=
"button3"
><a href=
"../Manufacture/add_job.php"
id=
"blue"
>งานผลิต</a></div>
138.
<div id=
"button4"
><a href=
"../formula/add_for.php"
id=
"perple"
>งานสูตรคำนวณ</a></div>
139.
<div id=
"right_button"
></div>
140.
<div id=
"lineunder_button"
></div>
141.
<div id=
"lift_sub1"
></div>
142.
<div id=
"sub1"
><a href=
"emp_register.php"
id=
"white"
>ทะเบียนพนักงาน</a></div>
143.
<div id=
"BTWsub1"
></div>
144.
<div id=
"menubt1"
><a href=
"cus_register.php"
id=
"useing"
>ข้อมูลลูกค้า</a></div>
145.
<div id=
"menubt2"
></div>
146.
<div id=
"menubt3"
></div>
147.
<div id=
"menubt4"
></div>
148.
<div id=
"right_menubt"
></div>
149.
<div id=
"content1"
>
150.
<div id=
"lift_sub2"
></div>
151.
<div id=
"sub2"
><a id=
"useing"
>ทะเบียนลูกค้า</a></div>
152.
<div id=
"lift_sub3"
></div>
153.
<div id=
"sub3"
></div>
154.
<div id=
"lift_sub4"
></div>
155.
<div id=
"sub4"
></div>
156.
<div id=
"lift_sub5"
></div>
157.
<div id=
"sub5"
></div>
158.
<div id=
"lift_sub6"
></div>
159.
<div id=
"sub6"
></div>
160.
</div>
161.
<div id=
"content2"
>
162.
<div id=
"lift_formin"
></div>
163.
<div id=
"form1"
>
164.
165.
166.
167.
<table width=
"698"
height=
"32"
border=
"0"
>
168.
169.
<tr>
170.
<td width=
"79"
height=
"26"
> ชื่อร้าน :</td>
171.
<td width=
"144"
><input type=
"text"
name=
"cus_edit_brandname"
size=
"20"
value=
"<?=$objResult["
cus_brandname
"];?>"
/></td>
172.
<td width=
"38"
>ชื่อ :</td>
173.
<td width=
"144"
><input type=
"text"
name=
"cus_edit_name"
size=
"20"
value=
"<?=$objResult["
cus_name
"];?>"
/></td>
174.
<td width=
"82"
>นามสกุล :</td>
175.
<td width=
"185"
><input type=
"text"
name=
"cus_edit_lname"
size=
"20"
value=
"<?=$objResult["
cus_lname
"];?>"
/></td>
176.
</tr>
177.
</table>
178.
<table width=
"692"
border=
"0"
>
179.
<tr>
180.
<td width=
"115"
height=
"39"
>เบอร์โทรศัพท์ :</td>
181.
<td width=
"127"
><input name=
"cus_edit_tel"
type=
"text"
value=
"<?=$objResult["
cus_tel"];?>
182.
" size="
20" /></td>
183.
<td width=
"57"
>ที่อยู่ :</td>
184.
<td width=
"375"
><input name=
"cus_edit_address"
type=
"text"
value=
"<?=$objResult["
cus_address"];?>
185.
" size="
60" /></td>
186.
</tr>
187.
</table>
188.
<table width=
"514"
height=
"32"
border=
"0"
>
189.
<tr>
190.
<td width=
"126"
height=
"26"
>เบอร์โทรสาร :</td>
191.
<td width=
"153"
><input type=
"text"
name=
"cus_edit_fax"
size=
"20"
value=
"<?=$objResult["
cus_fax
"];?>"
/></td>
192.
<td width=
"67"
>E-mail :</td>
193.
<td width=
"150"
><input type=
"text"
name=
"cus_edit_email"
size=
"20"
value=
"<?=$objResult["
cus_email
"];?>"
/></td>
194.
</tr>
195.
</table>
196.
<table width=
"256"
height=
"32"
border=
"0"
>
197.
<tr>
198.
<td width=
"102"
height=
"26"
>รหัสลูกค้า :</td>
199.
<td width=
"144"
><input type=
"text"
name=
"cus_edit_id"
size=
"10"
value=
"<?=$objResult["
cus_code
"];?>"
>
200.
<input type=
"hidden"
name=
"hdnEditcus_edit_id"
size=
"10"
value=
"<?=$objResult["
cus_code
"];?>"
></td>
201.
</tr>
202.
</table>
203.
<br /><br /><br /><br /><br />
204.
<table border=
"0"
align=
"right"
>
205.
<tr>
206.
<td ><input name=
"btnAdd"
type=
"button"
id=
"btnAdd"
value=
"เพิ่ม"
OnClick=
"frmMain.hdnCmd.value='Add';frmMain.submit();"
></td>
207.
<td ><input name=
"btnAdd"
type=
"button"
id=
"btnUpdate"
value=
"Update"
OnClick=
"frmMain.hdnCmd.value='Update';frmMain.submit();"
></td>
208.
<td ><input name=
"btnAdd"
type=
"button"
id=
"btnCancel"
value=
"Cancel"
OnClick=
"window.location='<?=$_SERVER["
PHP_SELF
"];?>';"
></td>
209.
</tr>
210.
211.
</table>
212.
</div>
213.
<div id=
"right_form1"
></div>
214.
</div>
215.
<div id=
"ft_form1"
></div>
216.
<div
class
=
"scroll"
id=
"form2"
>
217.
<table width=
"960"
height=
"auto"
border=
"1"
bordercolor=
"#0000FF"
bgcolor=
"#97CBFF"
>
218.
<tr>
219.
<td width=
"69"
height=
"23"
align=
"center"
bgcolor=
"#FFCC00"
>รหัสลูกค้า</td>
220.
<td width=
"91"
height=
"23"
align=
"center"
bgcolor=
"#FFCC00"
>ชื่อร้าน</td>
221.
<td width=
"73"
align=
"center"
bgcolor=
"#FFCC00"
>ชื่อ</td>
222.
<td width=
"90"
align=
"center"
bgcolor=
"#FFCC00"
>นามสกุล</td>
223.
<td width=
"108"
align=
"center"
bgcolor=
"#FFCC00"
>เบอร์โทรศัพท์</td>
224.
<td width=
"199"
align=
"center"
bgcolor=
"#FFCC00"
>ที่อยู่</td>
225.
<td width=
"95"
align=
"center"
bgcolor=
"#FFCC00"
>เบอร์โทรสาร</td>
226.
<td width=
"82"
align=
"center"
bgcolor=
"#FFCC00"
>E-mail</td>
227.
<td colspan=
"3"
align=
"center"
bgcolor=
"#FFCC00"
>เมนูการทำงาน</td>
228.
</tr>
229.
230.
<?
231.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
232.
{
233.
?>
234.
235.
236.
<tr>
237.
<td><div align=
"center"
><?=
$objResult
[
"cus_code"
];?></div></td>
238.
<td><?=
$objResult
[
"cus_brandname"
];?></td>
239.
<td><?=
$objResult
[
"cus_name"
];?></td>
240.
<td><?=
$objResult
[
"cus_lname"
];?></td>
241.
<td><?=
$objResult
[
"cus_tel"
];?></td>
242.
<td><?=
$objResult
[
"cus_address"
];?></td>
243.
<td><?=
$objResult
[
"cus_fax"
];?></td>
244.
<td><?=
$objResult
[
"cus_email"
];?></td>
245.
<td align=
"center"
><a href=
"<?=$_SERVER["
PHP_SELF
"];?>?Action=Edit&CusID=<?=$objResult["
cus_code
"];?>"
>แก้ไข
246.
</a></td>
247.
<td align=
"center"
><a href=
"JavaScript:if(confirm('Confirm Delete?')==true){window.location='<?=$_SERVER["
PHP_SELF
"];?>?Action=Del&CusID=<?=$objResult["
cus_code
"];?>';}"
>ลบข้อมูล</a></td>
248.
</tr>
249.
<?
250.
}
251.
?>
252.
253.
</table>
254.
<?
255.
mysql_close(
$objConnect
);
256.
?>
257.
</div>
258.
<div id=
"ft_form2"
>INGGLID WACHIRASEREECHAI 13510131</div>
259.
</div>
260.
</form>
261.
262.
</body>
263.
</html>