-
Notifications
You must be signed in to change notification settings - Fork 0
/
sub_EditUpdate.php
64 lines (48 loc) · 1.81 KB
/
sub_EditUpdate.php
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
<!-- DataBase connection -->
<?php require_once('database_connect.php'); ?>
<html>
<head>
<title>Update & delete</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.css" rel="stylesheet">
<!-- fontawesome iconpack -->
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet">
<!-- Custom styles -->
<link href="css/diluni.css" rel="stylesheet">
</head>
<body>
<!-- Delete button -->
<span class="pull-right"><button type="submit" class="btn btn-danger" onClick="deleteRow()"><i class="fa fa-trash-o"></i></button></span>
<!-- Edit button -->
<span style="pull-right"><a href="updateSubmission.php?postId=<?= $row['postId'] ?>" onClick="pop_up(this);return false;"><button class="btn bg-danger" style="background-color: #090; color:#FFF;"><i class="fa fa-edit"></i></button></a></span>
<script>
<!-- Delete function -->
function deleteRow(){
if(confirm('Are you sure to remove this record?'))
{
window.location.href='deleteSubmission.php?postId=<?= $row['postId']?>';
}
}
<!-- popup the edit window -->
function pop_up(url){
window.open(url,'win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=1000,height=500,directories=no,location=no')
}
//jQuery Library Comes First
//Bootstrap Library
$( document ).ready(function() {
$('#myModal').on('show.bs.modal', function (e) { //Modal Event
var id = $(e.relatedTarget).data('id'); //Fetch id from modal trigger button
$.ajax({
type : 'post',
url : 'file.php', //Here you will fetch records
data : 'post_id='+ id, //Pass $id
success : function(data){
$('.form-data').html(data);//Show fetched data from database
}
});
});
});
<!-- end of the popup window -->
</script>
</body>
</html>