-
Notifications
You must be signed in to change notification settings - Fork 0
/
remstud.php
57 lines (53 loc) · 1.26 KB
/
remstud.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="shortcut icon" href="logo.ico" />
<title>Remove Student</title>
</head>
<body>
<h1>Remove sudent</h1>
<form method="GET">
Roll No: <input type="text" autocomplete="off" name="Rno">
<br><br>
<button type ="submit">SUBMIT</button>
</form>
<br><br>
<button type="button" onclick="window.location.href ='edit.php'">Back to Edit page</button>
<?php
if(empty($_GET['Rno']))
{
echo"Fill the form";
}
else
{
$Rno=$_GET['Rno'];
$servername="localhost";
$username="id9023615_root";//uname and pass were taken from php myadmin page
$password="pwd54";
$dbname="id9023615_test_pr";
$conn=new mysqli($servername,$username,$password,$dbname);
if(! $conn)
{
die('could not connect'.mysql_error());
}
else
{
$sql="DELETE FROM stud_rec WHERE id='$Rno'";
$retval=mysqli_query($conn,$sql);
if(! $retval)
{
die ("ERROR".mysqli_error($conn));
}
else
{
echo " $Rno removed successfully";
}
}
//write sql query here (done)
}
?>
</body>
</html>