-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlist_contacted.php
More file actions
179 lines (164 loc) · 6.32 KB
/
list_contacted.php
File metadata and controls
179 lines (164 loc) · 6.32 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
session_start();
if(!isset($_SESSION['id'])){
header("location:login.php");
if(($_SESSION['id'] !=1)){
header("location:dashboard.php");
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Dashboard | Alone</title>
<!-- Material Icon CDN -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Materialize CSS CDN -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<!-- Your custom styles -->
<link rel="stylesheet" href="css/style.css">
<!-- Used as an example only to position the footer at the end of the page.
You can delete these styles or move it to your custom css file -->
<style>
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
main {
flex: 1 0 auto;
}
</style>
</head>
<?php
require_once("db-connection.php");
$id=$_SESSION['id'];
$sql = "SELECT * FROM `reach_us` WHERE 1";
$result = mysqli_query($conn,$sql);
?>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if($_POST['delete_item']){
$oid = $_POST['delete_item'];
$sql = "DELETE FROM `reach_us` WHERE contact_id ='$oid'";
if (mysqli_query($conn,$sql)) {
header("location:/list_contacted.php");
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
}
?>
<body>
<header>
<nav class="black">
<div class="nav-wrapper">
<div class="container">
<a href="/index.php" class="brand-logo pink-text">Alone</a>
<a href="#" data-activates="mobile-menu" class="button-collapse"><i class="material-icons">menu</i></a>
<ul class="right hide-on-med-and-down">
<li><a href="/index.php">Home</a></li>
<li><a href="/events.php">Events</a></li>
<?php if( isset($_SESSION['username']) && !empty($_SESSION['username']) )
{
?>
<li><a href="<?php if($id=='1'){echo "admin/admin_dashboard.php";}
else echo "/dashboard.php"; ?>" class="active">Dashboard</a></li>
<li><a href="logout.php">Logout</a></li>
<?php }else{ ?>
<li><a href="login.php">Login</a></li>
<li><a href="register.php">Register</a></li>
<?php } ?>
<li><a href="/contact.php">Contact us</a></li>
</ul>
</div>
</div>
</nav>
<div class="sidenav">
<a href="<?php if($id=='1'){echo "admin/admin_dashboard.php";}
else echo "/dashboard.php"; ?>">Dashboard</a>
<a href="/edit_user.php">Edit Profile</a>
<a href="<?php if($_SESSION['id']=='1'){echo "/all_donation.php";}
else echo "/donation_history.php"; ?>">Past Donation</a>
<a href="/event_list.php">Manage Events</a>
<a href="/user_list.php">Manage Users</a>
<a href="/org_list.php">Manage Organization</a>
<a href="/list_contacted.php">User Contacted</a>
</div>
</header>
<main>
<section >
<div class="container">
<div class="row ">
<div class="col s12">
<ul class="tabs">
<li class="tab col s6"><a class="active green-text" href="#test1">Contacted List</a></li>
</ul>
</div>
<div id="test1" class="col s12">
<table class="grey lighten-4">
<thead>
<tr>
<th class="black-text">Contact ID</th>
<th class="black-text">Name</th>
<th class="black-text">Email</th>
<th class="black-text">Description</th>
<th class="black-text">Phone</th>
<th class="black-text">Delete the Organization</th>
</tr>
</thead>
<tbody>
<?php
if ($result && $result->num_rows > 0) {
while($contacted = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $contacted['contact_id'] . "</td>";
echo "<td>" . $contacted['name'] . "</td>";
echo "<td>" . $contacted['email'] . "</td>";
echo "<td>" . $contacted['description'] . "</td>";
echo "<td>" . $contacted['phone_no'] . "</td>";
?>
<td><form action= "<?php $_SERVER['PHP_SELF'] ?>" method="post">
<button type="submit" class="btn waves-effect waves-light pink white-text darken-1" name="delete_item" value="<?php echo $contacted['contact_id'] ?> ">Delete</button>
</form>
</td>
<?php echo "</tr>";
}
}
echo "</table>"
?>
</div>
</div>
</div>
</section>
</main>
<?php require('footer.php'); ?>
<!-- jQuery CDN -->
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<!-- Materialize JS CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
<script>
$("document").ready(function(){
$(".button-collapse").sideNav();
});
$(document).ready(function(){
$('.carousel').carousel();
});
$('.carousel.carousel-slider').carousel({
fullWidth: true
});
$(document).ready(function(){
$('.tabs').tabs();
});
$(document).ready(function(){
$('.modal').modal();
});
$('table').on('click', 'input[type="button"]', function(e){
$(this).closest('tr').remove()
});
</script>
</body>
</html>