-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupd_std.php
58 lines (56 loc) · 2.02 KB
/
upd_std.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
<div id='lg'>
<button onclick="window.location.href='admin_page.php' ;">BACK</button>
</div>
<?php
session_start();
$db=mysqli_connect('localhost','root','','feedbacktrial') or die("Unable to connect mysql server.");
if(!isset($_SESSION['user_name'])){
header("location:page.html");
}
else{
echo "<br><h2><u>ENTER NEW STUDENT DETAILS</u></h2>";
echo "<strong><h4>IMPORTANT:Please use new roll no to register student and automatically student's username and password set as roll no.</h4></strong>";
if(isset($_POST['sub'])){
$roll=$_POST['rno'];
$nm=$_POST['name'];
$yr=$_POST['year'];
$mob=$_POST['mob'];
$sql="SELECT * from student where roll_no='$roll'";
$res=mysqli_query($db,$sql);
$n=mysqli_num_rows($res);
if($n==0){
$cp=md5($roll);
$s="INSERT into student values ('$roll','$nm','$yr','$roll','$cp','$mob')";
$r=mysqli_query($db,$s);
echo "<script> alert('SUCCESSFULLY ADDED')</script>";
}
else
echo "<script> alert('Student details exists.')</script>";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>UPDATE STUDENT DETAILS</title>
<link rel="stylesheet" href="upd_style.css">
</head>
<body>
<br>
<div class="login_form">
<h1 align="center"><u><i>DETAILS</i></u></h1>
<form action="upd_std.php" method="POST">
<strong>ROLL NO</strong><br>
<input type="text" name="rno" placeholder="roll no" required><br>
<strong>NAME</strong><br>
<input type="text" name="name" placeholder="name" required><br>
<strong>YEAR</strong><br>
<input type="text" name="year" placeholder="year" required><br>
<strong>MOBILE NO</strong><br>
<input type="text" name="mob" placeholder="mob no" required><br>
<input type="submit" value="SUBMIT" name="sub">
<br>
</form>
</div>
</body>
</html>