-
Notifications
You must be signed in to change notification settings - Fork 0
/
degcourse.php
173 lines (162 loc) · 4.65 KB
/
degcourse.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?php
include("logic/connection.php");
include("logic/back.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="css/index.css">
<link rel="stylesheet" href="css/degree.css">
<!-- fontawsome link -->
<script src="https://kit.fontawesome.com/dce4936410.js" crossorigin="anonymous"></script>
<!-- google font -->
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab&display=swap');
</style>
<title>Degree-College</title>
<script>
function validation() {
var crs = document.getElementById('crs').value;
var deg = document.getElementById('deg').value;
if(deg.length =='' ) {
let text;
// alert("degree should be more than 1 character");
//document.getElementById('nm').innerHTML=" name should be more than 1 character";
text = "Select a degree";
document.getElementById("demo").innerHTML = text;
return false;
}
if(crs.length =='' ) {
let text2;
// alert("degree should be more than 1 character");
//document.getElementById('nm').innerHTML=" name should be more than 1 character";
text2 = "Select a course";
document.getElementById("demo2").innerHTML = text2;
return false;
}
}
function hidewarn(a){
if(a!=''){
// text = "Select a degree";
// document.getElementById("demo").innerHTML = text;
// }else{
document.getElementById("demo").innerHTML = "";
}
}
function hidewarn2(a){
if(a!=''){
document.getElementById("demo2").innerHTML = "";
}
}
</script>
</head>
<body>
<!-- this is header -->
<Header>
<div class="logo"><img src="assets/logo.jpg" alt="logo" ></div>
</header>
<!-- this is hello section -->
<section class="hello">
<h1>degree page</h1>
</section>
<h1 style="color:red;">submit e problem</h1>
<!-- this is hero section -->
<section class="degree-hero">
<!-- hero section part one -->
<div class="part-one">
<form action="subdegcrs.php" method="post" onsubmit="return validation()">
<table>
<tr>
<td>degree :</td>
<td><select name="degid" id="deg" onchange='return hidewarn(this.value)'>
<option value="">select degree</option>
<?php
$query=mysqli_query($con,"SELECT * FROM `degree`");
while($result=mysqli_fetch_assoc($query)){
$degid=$result['degreeid'];
$degnm=$result['degreename'];
?>
<option value="<?php echo $degid; ?>"><?php echo $degnm;?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>course :</td>
<td><select name="crs" id="crs" onchange='return hidewarn2(this.value)'>
<option value="">select course</option>
<?php
$query1=mysqli_query($con,"SELECT * FROM `course`");
while($result1=mysqli_fetch_assoc($query1)){
$crsid=$result1['courseid'];
$crsnm=$result1['coursename'];
?>
<option value="<?php echo $crsid; ?>"><?php echo $crsnm;?></option>
<?php
}
?>
</select></td>
<td><input type="submit" name="submit"value="submit"></td>
</tr>
</table>
<b><p id='demo' style="color:red;"></p></b>
<b><p id='demo2' style="color:red;"></p></b>
</form>
</div>
<!-- hero section part two -->
<div class="part-two">
<table>
<tr>
<td>sid</td>
<td>degree</td>
<td>course</td>
<td>delete</td>
</tr>
<?php
$query2=mysqli_query($con,"SELECT * FROM `deg_crs`");
$total2=mysqli_num_rows($query2);
if($total2!=0){
$f=0;
while($result2=mysqli_fetch_assoc($query2)){
$sid=$result2['sid'];
$crsid=$result2['crsid'];
$degid=$result2['degid'];
$f++;
?>
<tr>
<td><?php echo $f; ?></td>
<td>
<?php
$query3=mysqli_query($con,"SELECT * FROM `degree` where degreeid='$degid'");
while($result3=mysqli_fetch_assoc($query3)){
$degnm1=$result3['degreename'];
}
echo $degnm1;
?>
</td>
<td><?php
$query4=mysqli_query($con,"SELECT * FROM `course` where courseid='$crsid'");
while($result4=mysqli_fetch_assoc($query4)){
$crsnm1=$result4['coursename'];
}
echo $crsnm1;
?></td>
<td><a href="delete/deldegcrs.php?sid=<?php echo $sid;?>"><i class="fa-solid fa-trash-can"></i></a></td>
</tr>
<?php
}
}else{
?>
<tr><td> there is no data</td></tr>
<?php
}
?>
</table>
</div>
</section>
<!-- this is footer section -->
<?php include("footer.php");?>
</body>
</html>