-
Notifications
You must be signed in to change notification settings - Fork 0
/
club.php
154 lines (134 loc) · 4.79 KB
/
club.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
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
<?php
session_start();
include 'includes/dbConnection.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="author" content="">
<title>AX GYM</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="js/scripts.js"></script>
<!-- Page level plugin CSS-->
<link href="vendor/datatables/dataTables.bootstrap4.css" rel="stylesheet">
<?php include 'globalExternals/components.php'; ?>
</head>
<body id="page-top" class="fixed-nav">
<?php include 'navigations/NavigationBar.php'; ?>
<div id="wrapper">
<div id="content-wrapper">
<div class="container-fluid">
<section class="content">
<br>
<div class="col-md-12 box box-default">
<div class="box-header">
<section class="content-header">
<h1>
<i class="fa fa-building"></i>
Club
</h1>
</section>
</div>
<hr>
<div class="container" id="member-registration-container">
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal"><i class="fas fa-plus" style="color: white;"></i> Club</button>
<br> <br> <br>
<!-- Table with query to fill it -->
<?php $sql = 'SELECT cl_id,cl_name,cl_location FROM club';
$query = mysqli_query($con, $sql);
if (!$query) {
die('SQL Error:' . mysqli_error($con));
}
?>
<!-- DataTables Example -->
<div class="card mb-3">
<div class="card-header"><i class="fas fa-table"></i> Club List</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th class="sorting_desc">Club Name</th>
<th class="sorting_desc">Location</th>
<th class="sorting_desc">Action</th>
</tr>
</thead>
<?php while ($row = mysqli_fetch_array($query)) { ?>
<tr>
<td><?php echo $row['cl_name']; ?></td>
<td><?php echo $row['cl_location']; ?></td>
<td>
<a href="" style="color:blue;"> <i class="fas fa-pen"></i></a>
<a href="club.php?idd=<?php echo $row['cl_id']; ?>" onclick="return confirm('Are you sure ?')" style="color:red;"><i class="fas fa-remove"></i></a>
</td>
</tr>
<?php
} ?>
</table>
</div>
</div>
<!-- Delete Query -->
<?php
if (isset($_GET['idd'])) {
$idd = $_GET['idd'];
$sql = "Delete from club where cl_id='" . $idd . "'";
if ($idd != '') {
$query = mysqli_query($con, $sql);
header("Refresh:0; url=club.php");
}
}
?>
<!-- session for add member button -->
<?php if (isset($_SESSION["success"])) { ?>
<div class="alert alert-success">
<strong>Success!</strong>
<?php echo $_SESSION["success"];
session_unset(); ?>
</div>
<?php
} ?>
<?php if (isset($_SESSION["error"])) { ?>
<div class="alert alert-danger">
<strong>Alert! </strong>
<?php echo $_SESSION["error"];
session_unset(); ?>
</div>
<?php
} ?>
<!-- ADD Club -->
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="card card-register">
<div class="card-header">Add Club</div>
<div class="card-body">
<form method="post" action="includes/phpScripts.php">
<div class="form-group">
<label>Club Name</label>
<input type="text" name="txtClubName" placeholder="Club Name" class="form-control">
</div>
<div class="form-group">
<label>Location</label>
<input type="text" name="txtClubLocation" placeholder="Club Location" class="form-control">
</div>
<div class="modal-footer">
<button class="btn btn-success btn-md" name="btnAddClub" type="submit">Add Club</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>