-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathedit-cate.php
More file actions
101 lines (96 loc) · 3.89 KB
/
edit-cate.php
File metadata and controls
101 lines (96 loc) · 3.89 KB
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
<?php include('db_connect.php');
// Check if the category ID is set
if(isset($_GET['id'])) {
// Prepare the SQL query
$stmt = $conn->prepare("SELECT * FROM categories WHERE id=?");
// Bind the category ID parameter
$stmt->bind_param("i", $_GET['id']);
// Execute the query
$stmt->execute();
// Get the result
$result = $stmt->get_result();
// Fetch the record
$record = $result->fetch_assoc();
// Close the statement
$stmt->close();
} else {
// If no category ID is provided, handle the error or redirect as needed
// For example:
// header("Location: error.php");
// exit();
}
?>
<div class="container-fluid">
<div class="col-lg-12">
<marquee onMouseOver="this.stop()" style="color: #e92f33;" onMouseOut="this.start()">This is a Code Camp BD's free source code for educational use only. It can never be used for commercial purposes. Don't forget to take <a target="_blank" href="https://www.youtube.com/@codecampbdofficial">Code Camp BD</a> permission if needed! to contact - <a target="_blank" href="https://www.facebook.com/dev.mhrony">MH RONY</a> </marquee>
<div class="row">
<!-- FORM Panel -->
<div class="col-md-4">
<form action="" id="manage-category">
<div class="card">
<div class="card-header">
Edit Category Form
</div>
<div class="card-body">
<input type="hidden" name="id" value="<?php echo $record['id']; ?>">
<div class="form-group">
<label class="control-label">Name</label>
<input type="text" class="form-control" name="name" value="<?php echo $record['name']; ?>">
</div>
</div>
<div class="card-footer">
<div class="row">
<div class="col-md-12">
<button class="btn btn-sm btn-primary col-sm-3 offset-md-3">Save</button>
<button class="btn btn-sm btn-default col-sm-3" type="button" onclick="$('#manage-category').get(0).reset()">Cancel</button>
</div>
</div>
</div>
</div>
</form>
</div>
<!-- FORM Panel -->
</div>
</div>
</div>
<style>
td {
vertical-align: middle !important;
}
</style>
<script>
$('#manage-category').submit(function(e){
e.preventDefault();
start_load();
$.ajax({
url:'ajax.php?action=edit_cate',
data: new FormData($(this)[0]),
cache: false,
contentType: false,
processData: false,
method: 'POST',
type: 'POST',
success:function(resp){
if(resp==1){
alert_toast("Data successfully added",'success');
setTimeout(function(){
window.location.href = 'index.php?page=manage_categories'; // Redirect to manage-category.php
},1500);
}
else if(resp==2){
alert_toast("Data successfully updated",'success');
setTimeout(function(){
location.reload();
},1500);
}
}
});
});
</script>
<!-- Author Name: MH RONY.
GigHub Link: https://github.com/dev-mhrony
Facebook Link:https://www.facebook.com/dev.mhrony
Youtube Link: https://www.youtube.com/channel/UChYhUxkwDNialcxj-OFRcDw
for any PHP, Laravel, Python, Dart, Flutter work contact me at developer.mhrony@gmail.com
Visit My Website : developerrony.com
-->