-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin_division.php
111 lines (98 loc) · 3.13 KB
/
admin_division.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
<?php
session_start();
include("config.php");
include("admin_function.php");
if(!isset($_SESSION['usertype']))
{
header("location:admin.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include("admin_head.php");?>
</head>
<body>
<?php include("admin_topnav.php"); ?>
<div class="container" style='margin-top:70px;'>
<div class="row">
<div class="col-sm-3">
<?php include("admin_side_nav.php");?>
</div>
<div class="col-sm-9" >
<h3 class='text-danger'> Add Division </h3><hr>
<div class="row">
<div class="col-md-6">
<?php
if(isset($_POST["division_submit"]))
{
$sql="INSERT INTO division (DIVISION_NAME,COUNTRY_ID) VALUES ('".$_POST["divisionname"]."',".$_POST["COUNTRY"].")";
$con->query($sql);
}
?>
<p id='out' class='text-success'></p>
<form role="form" action="admin_division.php" method="post">
<div class="form-group">
<label class="control-label text-danger" for="COUNTRY">Country</label>
<select name="COUNTRY" id="COUNTRY" required class="form-control">
<option value="">Select Country</option>
<?php
$sql="SELECT COUNTRY_ID,COUNTRY_NAME FROM country ORDER BY COUNTRY_NAME ASC";
$result=$con->query($sql);
if($result->num_rows>0)
{
while($row=$result->fetch_assoc())
{
echo "<option value='{$row['COUNTRY_ID']}'>{$row['COUNTRY_NAME']} </option>";
}
}
?>
</select>
</div>
<div class="form-group text-danger">
<label for="division">Division Name</label>
<input id="division" required type="text" class="form-control" name="divisionname">
</div>
<div class="form-group">
<input type="submit" class="btn btn-success" name='division_submit' value="Add Division">
</div>
</form>
</div>
<div class="col-md-6">
<?php
$sql="Select country.COUNTRY_NAME, division.DIVISION_NAME,division.DIVISION_ID
From division Inner Join
country On division.COUNTRY_ID = country.COUNTRY_ID ORDER BY DIVISION_ID desc LIMIT 0,10 ";
$result=$con->query($sql);
if($result->num_rows>0)
{
echo "<table class='table table-striped' >";
echo "<tr>
<th>Sno</th>
<th>Country Name</th>
<th>Division Name</th>
<th>Delete</th>
</tr>";
$i=0;
while($row=$result->fetch_assoc())
{
$i++;
echo"<tr>";
echo "<td>$i</td>";
echo "<td>".$row["COUNTRY_NAME"]."</td>";
echo "<td>".$row["DIVISION_NAME"]."</td>";
echo "<td><a href='admin_del_division.php?id=".$row["DIVISION_ID"]."' class='btn btn-danger btn-sm'><i class='fa fa-trash'></i></a></td>";
echo"</tr>";
}
echo "</table>";
}
?>
</div>
</div>
</div>
</div>
</div>
<hr>
<?php include("admin_footer.php"); ?>
</body>
</html>