-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewStudentSubmit.php
129 lines (125 loc) · 4.75 KB
/
viewStudentSubmit.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
<?php
$name=$rollno=$dept=$email=$address=$aboutme="";
$Ename=$Edept=$Eemail=$Erollno=$Eaddress="";
$pwd="";
$error=TRUE;
$servername="localhost";
$username="joy";
$password="password";
$dbname="mydb";
$conn=new mysqli($servername,$username,$password,$dbname);
if($conn->connect_error)
{
die("Connection Failed: ".$conn->connect_error);
}
else
echo "Connected!<br>";
$rollno="";
$readonly="readonly";
$disabled="disabled";
if($_SERVER["REQUEST_METHOD"]=="GET")
{
$rollno=$_GET["rollno"];
}
else if($_SERVER["REQUEST_METHOD"]=="POST")
{
$rollno1=$_POST["rollno1"];
$rollno=$rollno1;
$pwd=$_POST["pwd"];
$error="";
if(strlen($pwd)!=8)
{
$error="Wrong Password ".strlen($pwd);
}
else
{
$sql="SELECT * FROM student
WHERE Passcode='$pwd' AND Rollno='$rollno1';";
$out=$conn->query($sql);
if($out->num_rows==0)
{
$error="Wrong Password".$pwd;
}
else
{
$row=$out->fetch_assoc();
$readonly="";
$disabled="";
$name=$row["Name"];
$dept=$row["Department"];
$email=$row["Email"];
$address=$row["Address"];
$aboutme=$row["Aboutme"];
}
}
}
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<style>
body{
font-family: "Comic Sans MS";
}
span{
color:red;
font-family: "Times New Roman";
}
input[type=text]{
border: 1px solid grey;
border-radius: 5px;
padding: 5px;
}
form textarea{
border: 1px solid grey;
border-radius: 5px;
font-family: 'Comic Sans MS';
}
select{
padding: 5px;
border-radius:5px;
font-size: 15px;
}
input[type=submit]{
padding: 5px;
border-radius:5px;
font-size: 20px;
cursor: pointer;
outline: none;
}
input[type=password]{
padding: 5px;
border-radius:5px;
font-size: 15px;
}
</style>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="text" name="rollno1" value="<?php echo $rollno;?>" readonly="readonly"><br><br>
Passcode:<input type="password" name="pwd"><span>*<?php echo $error;?></span><br><br>
<input type="submit" value="Edit"><br><br>
Name:
<input type="text" name="name" value="<?php echo $name?>" <?php echo $readonly;?>><span> *<?php echo $Ename;?></span><br><br>
Department:
<select name="department" value="<?php echo $dept?>" <?php echo $disabled;?>>
<option value="Chemical">Chemical</option>
<option value="Civil">Civil</option>
<option value="CSE">CSE</option>
<option value="ECE">ECE</option>
<option value="EEE">EEE</option>
<option value="Mechanical">Mechanical</option>
<option value="Production">Production</option>
<option value="MME">MME</option>
</select><span> *</span><br><br>
Email:
<input type="text" name="email" value="<?php echo $email?>" <?php echo $readonly;?>><span> *<?php echo $Eemail;?></span><br><br>
Physical Address:
<textarea name="address" rows="5" cols="40" <?php echo $readonly;?>><?php echo $address?></textarea><span>*<?php echo $Eaddress?></span><br><br>
About me:
<textarea name="aboutme" rows="6" cols="40" <?php echo $readonly;?>><?php echo $aboutme?></textarea><br><br>
<input type="submit" formaction="finalChanges.php">
</form>
</body>
</html>