-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfastudentdetails.php
71 lines (56 loc) · 1.56 KB
/
fastudentdetails.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
<?php include('fa.php'); ?>
<article>
<form action='fastudentdetails.php' method='POST'>
Roll No:<input type='text' name='studentno' >
<input type='submit' name='getstudent' value='getstudent'>
</form>
<?php if(isset($_POST['getstudent'])){
$_SESSION['studentno']=$_POST['studentno'];
$_SESSION['check']=true;} ?>
<form action="fastudentdetails.php" method="POST"> <!--input type="submit" name="editdetails" value="editdetails"-->
<?php
if(isset($_SESSION['studentno'])){
if(!isset($_POST['editdetails'])){
echo '<input type="submit" name="editdetails" value="editdetails">';
}
}
?>
</form>
<?php echo $_SESSION['message']; ?>
<table>
<!--tr>
<th>Name</th>
<th>Value</th>
</tr-->
<?php
if ($_SESSION['check']==true){
echo "<tr><th>Name</th> <th>Value</th></tr>";
$rollno=$_SESSION['studentno'];
$servername='localhost';
$sqlname='root';
$sqlpassword='rohith';
$conn= new mysqli($servername, $sqlname, $sqlpassword);
if ($conn->connect_error){
die("connection failed : ".$conn->connect_error);
}
$sql="SELECT * FROM `FA_System`.`Student` WHERE `FA_System`.`Student`.`Roll_Number`='".$rollno."'";
$result=$conn->query($sql);
$row=$result->fetch_assoc();
$col=array_keys($row);
if (isset($_POST['editdetails']) || isset($_POST['editstudentdetails'])){
$student=$_SESSION['studentno'];
include('editstudentdetails.php');
}
else{
foreach ($col as $val){
echo '<tr><td>'.$val.'</td> <td>'.$row[$val].'</td></tr>';
}
}
}
?>
</table>
</article>
<footer>Copyright © National Institute of Technology Calicut</footer>
</div>
</body>
</html>