-
Notifications
You must be signed in to change notification settings - Fork 2
/
sdetailssubmit.php
128 lines (116 loc) · 2.76 KB
/
sdetailssubmit.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
<?php
session_start();
require_once("includes/connection.php");
require_once("includes/functions.php");uauthenticate();
require_once("navbar.html");
// Query the database for the username and password
global $connection;
echo "
<html>
<head>
<title>
Student Details
</title>
<link rel='stylesheet' href='Align.css' type='text/css' />
<style>
@import url(http://fonts.googleapis.com/css?family=Ubuntu:400,700);
body {
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
h1,
h2 {
color: #000;
text-shadow: 0 1px 1px rgba(0,0,0,0.7);
}
}
</style>
</head>
<body>
<div class='container'>
<div class='jumbotron'>
<h1>Student Information</h1>
";
$usn = $_POST['usn'];
$uid = $_SESSION["uid"];
$fname = $_POST['fname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$tenth = $_POST['10'];
$twelth = $_POST['12'];
$diploma = $_POST['dip'];
$sem1 = $_POST['s1'];
$sem2 = $_POST['s2'];
$sem3 = $_POST['s3'];
$sem4 = $_POST['s4'];
$sem5 = $_POST['s5'];
$sem6 = $_POST['s6'];
$sem7 = $_POST['s7'];
$sem8 = 0;
$cgpa = $_POST['cgpa'];
$back = $_POST['back'];
/*echo "<br>{$usn}<br>".
$uid.'<br>'.
$fname.'<br>'.
$email.'<br>'.
$phone.'<br>'.
$tenth.'<br>'.
$twelth.'<br>'.
$diploma.'<br>'.
$sem1.'<br>'.
$sem2.'<br>'.
$sem3.'<br>'.
$sem4.'<br>'.
$sem5.'<br>'.
$sem6.'<br>'.
$sem7.'<br>'.
$cgpa.'<br>'.
$back.'<br>';
*/
$query = "SELECT uid ";
$query .= "FROM studentdetails ";
$query .= "WHERE uid = ".$_SESSION["uid"]." ";
$query .= "LIMIT 1";
$result_set = mysqli_query($connection,$query);
if (mysqli_num_rows($result_set) == 1) {
$db_field = mysqli_fetch_array($result_set,MYSQLI_ASSOC);
$query ="UPDATE studentdetails SET
usn='{$usn}',
fullname='{$fname}',
email='{$email}',
contact='{$phone}',
tenth='{$tenth}',
twelth='{$twelth}',
diploma='{$diploma}',
sem1={$sem1},
sem2={$sem2},
sem3={$sem3},
sem4={$sem4},
sem5={$sem5},
sem6={$sem6},
sem7={$sem7},
cgpa={$cgpa},
backlogs={$back} WHERE uid={$uid}
";
} else {
$query = "INSERT INTO studentdetails VALUES ('{$usn}',{$uid},
'{$fname}','{$email}',
'{$phone}','{$tenth}',
'{$twelth}','{$diploma}',
{$sem1},{$sem2},
{$sem3},{$sem4},
{$sem5},{$sem6},
{$sem7},{$sem8},{$cgpa},{$back},'CS')";
}
//echo $query;
$result = mysqli_query($connection,$query);
if ($result) {
echo "<h3>The user details was successfully updated.</h3>";
} else {
echo "<h3>The details was not updated.Try Again.</h3>";
}
echo "</div>
</body>
</html>";
?>