1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
<?php $error=0;
//------------------------------------------------------------- if($_POST['action']=='updateStatus'){ $query="UPDATE tbl_home_reserv SET `home_status` = '".$_POST['statusChange']."' WHERE id = '".$_POST['EditID']."' "; mysql_query($query); } //---------------------------------------- //------------------------------------------------------------- $query="SELECT * FROM tbl_home_reserv WHERE home_code_id = '".$_GET['CodeID']."' ORDER BY id ASC "; $result=mysql_query($query);
?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script language="javascript"> //-------------------------------- function FormValid(){ if(document.form1.box_name.value==''){ alert("กรุณาใส่ชื่อ"); return false; }else { document.form1.action.value = 'AddPack'; } } //--------------------------------------------------- function EditThis(ids,nums){ document.form1.EditID.value=ids; document.form1.num.value=nums; document.form1.action.value = 'EditCate'; document.form1.submit(); } //--------------------------------------------------- function DeleteThis(ids,bgimg){ if(confirm('ต้องการลบรายการนี้')){ document.form1.EditID.value=ids; document.form1.action.value = 'DelteCate'; document.form1.submit(); }else{ return false; } } //--------------------------------------------------- function changeStatusThis(ids, homestatus){ if(homestatus==1){ chStatus=0; }else{ chStatus=1; } document.form1.EditID.value=ids; document.form1.statusChange.value=chStatus; document.form1.action.value = 'updateStatus'; document.form1.submit(); } </script> </head>
<body> <form action="<?php $_SERVER['PHP_SELF']?>" method="post" name="form1" onSubmit="return FormValid();" enctype="multipart/form-data"> <table width="100%" border="0" cellspacing="3" cellpadding="3"> <tr> <td class="txt10-black"> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr class="txt10-black"> <td width="100%" height="30" align="left" bgcolor="#FFFFFF" class="txt10-black" ><img src="images/black_icon/16x16/notepad_2.png" width="16" height="16" hspace="5" align="absmiddle" />code list <input type="hidden" name="EditID" id="EditID" /> <input type="hidden" name="action" id="action" /> <input type="hidden" name="statusChange" id="statusChange" /></td> </tr> <tr> <td align="left"><table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td align="center" bgcolor="#E1E1E1"> </td> <td width="74%" bgcolor="#E1E1E1"> </td> <td align="center" bgcolor="#E1E1E1" class="txt10-black">สถานะ</td> </tr> <?php $n=1;while($data=mysql_fetch_assoc($result)){ if($data['home_status']=='1'){ $bgcolor='#E8FF88';}else{ $bgcolor='#FFFFFF'; } ?> <tr bgcolor="<?php echo $bgcolor?>" onMouseover="this.bgColor='#EEEEEE'"onMouseout="this.bgColor='<?php echo $bgcolor?>'"> <td width="3%" align="center"><img src="images/black_icon/16x16/rnd_br_next.png" width="16" height="16" /></td> <td><?php echo $data['box_name']?></td> <td width="23%" align="center"><input type="checkbox" name="reserv[]" <?php if($data['home_status']=='1'){ echo "checked"; }?> onclick="changeStatusThis('<?php echo $data['id']?>', '<?php echo $data['home_status']?>')" /> <label for="reserv">จองแล้ว</label></td> </tr> <tr> <td height="1" colspan="3" align="center" bgcolor="#E1E1E1"></td> </tr> <?php $n++; }?> </table></td> </tr> </table></td> </tr> </table> </form> </body> </html>
|