-
Notifications
You must be signed in to change notification settings - Fork 0
/
userData.php
143 lines (112 loc) · 3.44 KB
/
userData.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
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Login Form</title>
<link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Open+Sans:600'>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/userD.css">
</head>
<?php
session_start();
$dbhost="localhost";
$dbname="sarchive";
$dbuser="root";
$dbpass="";
$conn=mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);
if(mysqli_connect_errno()){
die("database connection failed:".mysqli_connect_error()."(".mysqli_connect_errno().")");
}
if(isset($_SESSION['users'])){
$name = $_SESSION['users'];
$sql = "SELECT fname, lname, university FROM registration where email='".$name."'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) == 0) {
echo "sorry";}
else{
while($row = mysqli_fetch_assoc($result)) {
$fname = $row["fname"];
$lname = $row["lname"];
$university = $row["university"];
}
}
}
else{
$fname = "nobody";
}
?>
<body>
<div class="login-wrap1">
<div class="login-html">
<h3 style="color: white;">Howdy, <?php echo $fname.'!'; ?></h3>
<input id="tab-1" type="radio" name="tab" class="sign-in" checked><label for="tab-1" class="tab"><?php echo $university.' '; ?>University</label>
<input id="tab-2" type="radio" name="tab" class="sign-up"><label for="tab-2" class="tab"></label>
<div class="login-form">
<div class="sign-in-htm">
<div id="wrapper">
<form action="display.php" method="POST">
<div id="upleft">
<div class="group">
<label for="dept" class="label"><h3>Department</h3></label>
<select id="dept" name="dept" class="input" style="position: center; color: black; " onchange="getId(this.value);" required >
<!-- <option value="CS">CS</option>
<option value="IT">IT</option>
<option value="ECE"><font color="black">ECE</font></option> -->
<option value="">Select Department</option>
<?php
$query = "SELECT * FROM dept";
$res = mysqli_query($conn, $query);
foreach ($res as $dept ) {
# code...
?>
<option value="<?php echo $dept['dID']; ?>"><?php echo $dept["dname"]; ?></option>
<p><?php echo $dept["dname"]; ?></p>
<?php
}
?>
</select>
</div>
</div>
<div class="Course" id="upright">
<div class="group">
<label for="Course" class="label"><h3>Course</h3></label>
<select id="Course" name="Course" class="input" style="position: center; color: black; " required>
<option value="">Select Course</option>
<option value=""></option>
</select>
</div>
</div>
<div id="below">
<div class="group">
<input type="submit" class="button" value="Go" style="margin-top: 50px; ">
</div>
</div>
</form>
</div>
<hr>
<div class="foot-lnk" >
<a id="Logout" href="index.html" style="color: black; ">Logout</a>
<?php
//$_SESSION['users'] =$_POST[$name];
?>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-1.12.0.min.js" ></script>
<script>
function getId(val) {
//alert(val) ;
$.ajax({
type: "POST",
url: "getData.php",
data: "dID="+val,
success: function(data){
$("#Course").html(data);
}
});
}
</script>
</body>
</html>