001.
<?php session_start();
002.
include
(
'include\Connection.php'
);
003.
?>
004.
005.
<!DOCTYPE HTML>
006.
<html>
007.
<head>
008.
<meta charset=
"utf-8"
>
009.
<meta name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
013.
<script src=
"js/jquery-3.1.1.min.js"
></script>
014.
<script src=
"js/bootstrap.min.js"
></script>
015.
016.
017.
<title>ระบบบันทึกข้อมูล</title>
018.
019.
<style>
020.
#myBtn {
021.
display: none;
022.
position: fixed;
023.
bottom: 20px;
024.
right: 30px;
025.
z-index: 99;
026.
border: none;
027.
outline: none;
028.
background-color: MediumSeaGreen;
029.
color: white;
030.
cursor: pointer;
031.
padding: 10px;
032.
border-radius: 10px;
033.
}
034.
035.
#myBtn:hover {
036.
background-color: #555;
037.
}
038.
</style>
039.
<style>
040.
closebtn {
041.
margin-left: 15px;
042.
font-weight: bold;
043.
float: right;
044.
font-size: 22px;
045.
line-height: 20px;
046.
cursor: pointer;
047.
transition: 0.3s;
048.
}
049.
.closebtn:hover {
050.
color: black;
051.
}
052.
053.
.alert {
054.
padding: 0px;
055.
opacity: 1;
056.
transition: opacity 0.6s;
057.
margin-bottom: 15px;
058.
}
059.
060.
.closebtn {
061.
margin-left: 15px;
062.
font-weight: bold;
063.
float: right;
064.
font-size: 22px;
065.
line-height: 20px;
066.
cursor: pointer;
067.
transition: 0.3s;
068.
}
069.
070.
.closebtn:hover {
071.
color: black;
072.
}
073.
</style>
074.
075.
076.
</head>
077.
<body>
078.
<h1 align=
"center"
>ข้อมูลผู้ลงสมัคร</h1>
079.
<div
class
=
"container"
>
080.
081.
<?php
082.
if
(isset(
$_GET
[
'id'
])){
083.
$del
=
$_GET
[
'id'
];
084.
085.
086.
mysql_query(
"DELETE FROM mamberWHERE id='{$del}'"
);
087.
}
088.
?>
089.
090.
091.
<?php;
092.
$result
= mysql_query(
"SELECT * FROM mamber"
); ?>
093.
094.
<h2>ข้อมูลผู้ลงชื่อ</h2>
095.
<p> ผู้ใช้สามารถเพิ่มข้อมูล <a href=
"index.php"
class
=
"btn btn-primary btn-xs"
role=
"button"
>บันทึกข้อมูล</a></p>
096.
<table
class
=
"table table-hover"
>
097.
<thead>
098.
<tr>
099.
<th>id</th>
100.
<th>PID</th>
101.
<th>DATE_DIAG</th>
102.
<th>CHRONIC</th>
103.
<th>HOPS_DX</th>
104.
<th>HOPS_RX</th>
105.
<th>DATE_DISCH</th>
106.
<th>TYPEDISCH</th>
107.
<th>D_UPDATE</th>
108.
</tr>
109.
</thead>
110.
<tbody>
111.
112.
<?php
113.
while
(
$row
= mysql_fetch_array(
$result
)) {
114.
?>
115.
<tr>
116.
<td><?php
echo
$row
[
'id]'
];?></td>
117.
<td><?php
echo
$row
[
''
name];?></td>
118.
<td><?php
echo
$row
[
'birthday '
];?></td>
119.
<td><?php
echo
$row
[
'number'
];?></td>
120.
<td><?php
echo
$row
[
'address'
];?></td>
121.
<td><?php
echo
$row
[
'email'
];?></td>
122.
<td><?php
echo
$row
[
'status'
];?></td>
123.
<td>
124.
125.
<a href=
"#"
ids=
'<?php echo $row['
id
']; ?>'
class
=
"btn btn-warning btn-sm edit"
role=
"button"
data-toggle=
"modal"
data-target=
"#edit"
>
126.
<span
class
=
'glyphicon glyphicon-edit'
></span></button></a>
127.
128.
<a href=
"#"
ids=
'<?php echo $row['
id
']; ?>'
class
=
"btn btn-danger btn-sm dels"
role=
"button"
data-toggle=
"modal"
data-target=
"#myDelete"
>
129.
<span
class
=
'glyphicon glyphicon-trash'
></span></a>
130.
</td>
131.
</tr>
132.
133.
134.
<?php
135.
if
(isset(
$_row
[
'submit'
])){
136.
$mysql_query
="UPDATE chronic SET
137.
138.
$_row
[
'id'
];
139.
$_row
[
'name'
];
140.
$_row
[
'birthday '
]
141.
$_row
[
'number'
];
142.
$_row
[
'address'
];
143.
$_row
[
'email'
];
144.
$_row
[
'status'
];
145.
146.
id =
'$id'
,
147.
name =
'$name'
,
148.
birthday =
'$birthday '
,
149.
number =
'$number'
,
150.
address =
'$address'
,
151.
email =
'$email'
,
152.
status =
'$status'
153.
154.
WHERE id=
'$id'
";
155.
?>
156.
157.
158.
<?php
159.
}
160.
?>
161.
162.
</tbody>
163.
</table>
164.
165.
<!--In Stock/s Modal -->
166.
<div id=
"edit"
class
=
"modal fade"
role=
"dialog"
>
167.
<div
class
=
"modal-dialog"
role=
"document"
>
168.
<form method=
"get"
class
=
"form-horizontal"
role=
"form"
>
169.
170.
<!-- Modal content-->
171.
<div
class
=
"modal-content"
>
172.
<div
class
=
"modal-header"
>
173.
174.
<button type=
"button"
class
=
"close"
data-dismiss=
"modal"
>×</button>
175.
<h4
class
=
"modal-title"
>แก้ไขข้อมูลผู้ลงสมัคร</h4>
176.
</div>
177.
178.
<div
class
=
"modal-body"
>
179.
<div
class
=
"form-group"
>
180.
<label
class
=
"col-sm-2 control-label"
for
=
"id"
>id:</label>
181.
<div
class
=
"col-sm-10"
>
182.
<input type=
"text"
class
=
"form-control"
id=
"id"
name=
"id"
value=
"<?php echo $row['id'];?>"
>
183.
</div></div>
184.
185.
<div
class
=
"form-group"
>
186.
<label
class
=
"col-sm-2 control-label"
for
=
"name"
>name:</label>
187.
<div
class
=
"col-sm-10"
>
188.
<input type=
"text"
class
=
"form-control"
id=
"name"
name=
"name"
value=
"<?php echo $row['name']; ?>"
>
189.
</div></div>
190.
191.
<div
class
=
"form-group"
>
192.
<label
class
=
"col-sm-2 control-label"
for
=
"item_code"
>birthday :</label>
193.
<div
class
=
"col-sm-10"
>
194.
<input type=
"text"
class
=
"form-control"
id=
"birthday "
name=
"birthday "
value=
"<?php echo $row['birthday ']; ?>"
>
195.
</div></div>
196.
197.
<div
class
=
"form-group"
>
198.
<label
class
=
"col-sm-2 control-label"
for
=
"number"
>number:</label>
199.
<div
class
=
"col-sm-10"
>
200.
<input type=
"text"
class
=
"form-control"
id=
"number"
name=
"number"
value=
"<?php echo $row['number']; ?>"
>
201.
</div></div>
202.
203.
<div
class
=
"form-group"
>
204.
<label
class
=
"col-sm-2 control-label"
for
=
"address"
>address:</label>
205.
<div
class
=
"col-sm-10"
>
206.
<input type=
"text"
class
=
"form-control"
id=
"address"
name=
"address"
value=
"<?php echo $row['address']; ?>"
>
207.
</div></div>
208.
209.
<div
class
=
"form-group"
>
210.
<label
class
=
"col-sm-2 control-label"
for
=
"email"
>email:</label>
211.
<div
class
=
"col-sm-10"
>
212.
<input type=
"text"
class
=
"form-control"
id=
"email"
name=
"email"
value=
"<?php echo $row['email']; ?>"
>
213.
</div></div>
214.
215.
<div
class
=
"form-group"
>
216.
<label
class
=
"col-sm-2 control-label"
for
=
"status"
>status:</label>
217.
<div
class
=
"col-sm-10"
>
218.
<input type=
"text"
class
=
"form-control"
id=
"status"
name=
"status"
value=
"<?php echo $row['status']; ?>"
>
219.
</div></div>
220.
221.
222.
<div
class
=
"modal-footer"
>
223.
<button type=
"submit"
class
=
"btn btn-success"
name=
"update_item"
><span ></span>บันทึกการแก้ไข</button>
224.
<button type=
"button"
class
=
"btn btn-danger"
data-dismiss=
"modal"
><span ></span>ยกเลิก</button>
225.
</div></div>
226.
</form>
227.
</div>
228.
</div>
229.
</div>
230.
</div>
231.
232.
<!-- Modal -->
233.
<div id=
"myDelete"
class
=
"modal fade"
role=
"dialog"
>
234.
<div
class
=
"modal-dialog"
>
235.
236.
<!-- Modal content-->
237.
<div
class
=
"modal-content"
>
238.
<div
class
=
"modal-header"
>
239.
<button type=
"button"
class
=
"close"
data-dismiss=
"modal"
>×</button>
240.
<h4
class
=
"modal-title"
>ยืนยันการลบ</h4>
241.
242.
</div>
243.
<div
class
=
"modal-body"
>
244.
<p>คุณต้องการลบข้อมูลผู้ป่วยรายนี้ ?</p></div>
245.
246.
<form role=
"form"
method=
"get"
action=
""
>
247.
<input type=
"hidden"
id=
"hosp"
name=
"hosp"
>
248.
<div
class
=
"modal-footer"
>
249.
<button type=
"submit"
class
=
"btn btn-success"
>ตกลง</button>
250.
<button type=
"button"
class
=
"btn btn-danger"
data-dismiss=
"modal"
>ยกเลิก</button>
251.
</div>
252.
</form>
253.
</div>
254.
</div>
255.
</div>
256.
<?php mysql_close(
$serv
);?>
257.
</div>
258.
</body>
259.
<script>
260.
$(
'a.dels'
).click(
function
(){
261.
262.
$(
'#id'
).attr(
'value'
, $(this).attr(
'ids'
));
263.
});
264.
265.
266.
267.
$_row
[
'id'
];
268.
$_row
[
'name'
];
269.
$_row
[
'name'
]
270.
$_row
[
'number'
];
271.
$_row
[
'address'
];
272.
$_row
[
'email'
];
273.
$_row
[
'status'
];
274.
275.
276.
</script>
277.
<script>
278.
279.
$(
'edit'
).click(
function
(){
280.
$(
'#id'
).attr(
'value'
, $(this).attr(
'edit'
));
281.
method:
'GET'
282.
$.getJSON(
'view.php?edit='
+ id,
function
(obj) {
283.
$(
'#id'
).val(obj.id);
284.
$('#name).val(obj.name);
285.
$(
'#birthday '
).val(obj.birthday );
286.
$(
'#number'
).val(obj.number);
287.
$(
'#address'
).val(obj.address);
288.
$(
'#email'
).val(obj.email);
289.
$(
'#status'
).val(obj.status)
290.
$(
'#edit-modal'
).modal(
'show'
)
291.
}).fail(
function
() { alert(
'Unable to fetch data, please try again later.'
) });
292.
}
else
alert(
'Unknown row edit.'
);
293.
}
294.
</script>
295.
<script>
296.
297.
bootbox
298.
.dialog({
299.
title:
'Edit the user profile'
,
300.
message: $(
'#id'
),
301.
show: false
302.
})
303.
.on(
'shown.bs.modal'
,
function
() {
304.
$(
'#id'
)
305.
.show()
306.
.formValidation(
'resetForm'
);
307.
})
308.
.on(
'hide.bs.modal'
,
function
(e) {
309.
$(
'#id'
).hide().appendTo(
'body'
);
310.
})
311.
.modal(
'show'
);
312.
</script>
313.
</html>