-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_event.php
96 lines (71 loc) · 2.28 KB
/
edit_event.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
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
<?php
require("connection.php");
// Check if ID is provided in the URL
if (isset($_GET['id'])) {
// Get the ID from the URL
$id = $_GET['id'];
// Prepare and execute the query
$sql = "SELECT * FROM event_table WHERE id=$id";
$result = mysqli_query($connection, $sql);
// Check if query executed successfully
if (!$result) {
die("Error executing query: " . mysqli_error($connection));
}
// Fetch the data from the result
$row = mysqli_fetch_assoc($result);
// Close connection (optional)
mysqli_close($connection);
} else {
// Redirect to an error page or display an error message
echo "Event ID not provided.";
}
?>
<html>
<head>
<?php include "head.php";?>
</head>
<body style="font-family:verdana;">
<div style="margin-top:20px;">
<div style="float:left;margin-left:50px;">
Welcome: admin</div>
<div style="float:right;margin-right:50px;">
<a href="index-digital.php">Home</a>
</div>
</div>
<div style="clear: both;"></div>
<h1>EVENTS</h1>
<form id="form1" name="form1" class="white-pink" action="update_event.php?id=<?php echo $row['id'];?>" method="POST">
<label>
<span>Event Name:</span>
<input type="text" id="event_name" name="event" value="<?php echo $row['event_name'];?>" required autofocus>
</label>
<label>
<span>Event Description:</span>
<textarea id="event_description" name="event_description" value"<?php echo $row['description'];?>"></textarea>
</label>
<label>
<span> </span>
<input type="submit" id="submit" name="submit" value="Update" class="button">
<input type="reset" value="Reset" class="button">
<input type="button" onClick="location.href='fetch_event.php'" value="Edit" class="button">
</label>
</form>
<center><h2><p id="info1"></p></h2></center>
//<script type="text/javascript">
/*$('#form1').submit(function(event) {
event.preventDefault();
//alert($(this).serialize());
$.ajax({
type: 'POST',
url: 'event_back.php',
data: $(this).serialize(),
dataType: 'json',
success: function (data) {
console.log(data);
$('#info1').html(data.msg);
$("#form1")[0].reset();
}
});
});*/
</script>
</body></html>