0% found this document useful (0 votes)
60 views29 pages

Ex. No: Hostel Management System Date

This document describes a hostel management system developed using PHP and MySQL. The system aims to manage various hostel activities online to improve efficiency over a manual system. It includes six modules - login, add room, view registration, room allocation, add profile, view profile, and room details. The login module allows users to register and login. The add room module allows admins to add room details. Other modules allow viewing student details, allocating rooms, and viewing profile and room details. The document provides hardware, software and module descriptions, use case diagrams, and code snippets for the home and room detail pages.

Uploaded by

sharmila
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views29 pages

Ex. No: Hostel Management System Date

This document describes a hostel management system developed using PHP and MySQL. The system aims to manage various hostel activities online to improve efficiency over a manual system. It includes six modules - login, add room, view registration, room allocation, add profile, view profile, and room details. The login module allows users to register and login. The add room module allows admins to add room details. Other modules allow viewing student details, allocating rooms, and viewing profile and room details. The document provides hardware, software and module descriptions, use case diagrams, and code snippets for the home and room detail pages.

Uploaded by

sharmila
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Ex.

No:
HOSTEL MANAGEMENT SYSTEM

Date:

Aim:

To develop a hostel management system by using PHP language.

Abstract:

Hostel Management System is an online application developed for managing various


activities of the hostel. This particular project deals with the problem on managing the hostel and
avoid the problems which occur when carried manually. We can improve the efficiency of the
system, thus overcome the drawbacks of the existing system. This project is developed in PHP
language.

Requirements:

Hardware Requirements:

 Processor : 1 GHz.
 RAM : 1GB.
 Operating System: Windows.

Software Requirement:

 Front End : PHP


 Back End : Mysql

Module Description:
In this project six modules are used
 Login
 Add Room
 View Registration
 Room Allocation
 Add Profile
 View Profile
 Room Detail
Login:

In this module the new user can register into a bank and after that they can access the
application with their proper used id and password. If the user id and password are incorrect they
cannot access the application.

Add Room:

In this module admin can add the room details for room allocation. The room details are
hostel name, Room no and hostel address.

View Registration:

In this module admin can view the student registration details. If the student are not allocate
a room the admin can allocate room for the particular students. The registration details are student
name, student register no, email id, contact number etc.,

Room Allocation:
In this module admin can allocate the room for student whether the student are allocate or
not. The room allocation details are student name, registration number, hostel name, hostel
address, room number etc.,

Add Profile:

In this module student can add their profile details. The profile details are student name,
registration number, contact, email id, course details etc.,

View Profile:

In this module student can only view their profile details like student name, registration
number, contact, address, email id etc.,

Room Detail:

In this module student are view their room details . If the student are getting room allocate
or not. The room details are student name, registration number, email id and room no.
Use case Diagram:
Home page:

<html>
<head>
</head>
<body>
<link rel="stylesheet" href="home.css">
<div id="header">
</div>
<div id="head">
<div id="img">
<img src="logo.png" height="100px" width="200px" >
</div>
<div id="menu">
<ul>
<li><a href ="#">Home</a></li>
<li><a href ="#" id="button">Login/singup</a></li>
<li><a href ="#footer">Contact us</a></li>
</ul>
</div>
</div>
<div id="banner">
<img src="lol1.jpg" id="image" >
<script>
x=["lol1.jpg","lol2.jpg"];
slide=document.getElementById("image");
count=0;
function forward()
{
count=count+1;
if(count<=x.length)
{
if(count==x.length)
{
count=0;
}
slide.src=x[count];
}
console.log(count);
}
setInterval(forward,2000);

</script>
</div>
<div id="footer">
<ul><li><a href="#">WELCOME</a></li>
<li><a href="#" class="button" id="button">LOGIN/SINGUP</a></li>
<li><a href="#">ABOUT US</a></li>
<li><a href="#">CONTACT</a></li>
</ul>
<p> &copy; 2019| Designed by Durgadevi..</p>
</div>
<div class="forms" id="forms">
<div class="popup">
<img src="close.jpg" class="close">
<center><table id="table">
<form method="POST">
<tr><td>Regno:</td><td><input type="text" name="regnos" required value=""></td></tr>
<tr><td>&nbsp</td></tr>
<tr><td>Password</td><td><input type="password" name="passw" required
value=""></td><tr>
<tr><td>&nbsp</td></tr>
<center><tr><td><input type="submit" name="login" value="Login"></td></tr></center>
<tr><td>&nbsp</td></tr>
<tr><td>Didn't register please..</td><td><a href="#" id="buttons">New Register</a></td></tr>
</form></table></center>
</div>
</div>
<script>
document.getElementById("button").addEventListener("click",function(){document.querySelect
or(".forms").style.display="flex";
})
document.querySelector(".close").addEventListener("click",function(){document.querySelector(
".forms").style.display="none";
})
</script>
<div class="form">
<div class="pop">
<img src="close.jpg" class="closes">
center><table id="table">
<form method="POST">
<tr><td>Register no:</td><td><input type="text" required name="regno"value=""></td></tr>
<tr><td>&nbsp</td></tr>
<tr><td>Student name:</td><td><input type="text" required
name="stuname"value=""></td></tr>
<tr><td>&nbsp</td></tr>
<tr><td>Gender:</td><td><input type="radio" required name="g"
value="male">Male</td><td><input type="radio" required name="g"
value="female">Female</td></tr>
<tr><td>&nbsp</td></tr>
<tr><td>Contact no:</td><td><input type="text" name="contact" required value=""></td></tr>
<tr><td>&nbsp</td></tr>
<tr><td>Email-id:</td><td><input type="text" required name="email" value=""></td></tr>
<tr><td>&nbsp</td></tr>
<tr><td>Password</td><td><input type="text" required name="pass" value=""></td><tr>
<tr><td>&nbsp</td></tr>
<center><tr colspan="2"><td><input type="submit" name="submit"
value="Register"></td></tr></center>
<tr><td>&nbsp</td></tr>
<tr><td>You already have an account..</td><td><a href="#" class="login"
>Login</a></td></tr>
</form></table></center>

</div>
</div>
<script>
document.getElementById("buttons").addEventListener("click",function(){document.querySelec
tor(".form").style.display="flex";

})
document.querySelector(".closes").addEventListener("click",function(){document.querySelector
(".form").style.display="none";
})
document.querySelector(".login").addEventListener("click",function(){document.querySelector(
".form").style.display="none";
})

</script>
</body>
</html>
<?php
session_start();
$con=new mysqli('localhost','root','','hostel');
if($con->connect_errno)
{
echo $con->connect_erro;
die();
}
?>
<?php
if(isset($_POST['submit']))
{
$regno=$_POST['regno'];
$stuname=$_POST['stuname'];
$pass=$_POST['pass'];
$gen=$_POST['g'];
$contact=$_POST['contact'];
$email=$_POST['email'];
if($email!="" && $pass!="")
{
$sql="SELECT regno FROM registration where BINARY regno='$regno'";
$sqli="SELECT emailid FROM registration where BINARY emailid='$email'";
$result=$con->query($sql);

$res=$con->query($sqli);
if($result->num_rows>0)
{
echo '<script>alert("Register no alredy exits:")</script>';
}
elseif($res->num_rows>0)
{
echo '<script>alert("email id alredy exits:")</script>';
}
else

{
$sql="INSERT INTO registration(regno, stuname, gender, contact, emailid, password)
VALUES ('$regno','$stuname','$gen','$contact','$email','$pass')";
if($con->query($sql))
{
echo '<script>alert("Register successfully")</script>';
}
else
{
echo "<h3>Registration failed :(</h3>";
}
}
}
else
{
echo "<h3>All field required</h3>";
}
}?>

<?php
if(isset($_POST['login']))
{
$regnos=mysql_real_escape_string($_POST['regnos']);
$_SESSION["regnos"]=$regnos;
$passw=mysql_real_escape_string($_POST['passw']);
if($regnos!=""&&$passw!="")
{
$sql="SELECT * FROM registration where BINARY regno='$regnos' AND
password='$passw'";
$result=$con->query($sql);
if($result->num_rows==1)
{
$row=$result->fetch_assoc();
header("location:stuprofile.php");
}
else
{
echo '<script>alert("Invalid password or regno:")</script>';
}
}

else
{
echo "<h2>Please enter data</h2>";
}
}

?>

Room Detail:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<style>
#header
{
background:#CCCCCC;
height:28px;
font-size:26px;

width:100%;
}

#header a{
float:right;
}
#right
{
height:50px;;
width:100%;
background-color:#FFCCCC;
float:left;
margin-top:2%;
}
#right ul{
margin-top:2%;
}
#right ul li{
padding:30px;
display:inline;
}
#right a{
text-align:center;
font-size:26px;
text-decoration:none;
}
#margin{
margin-top:2%;
float:left;
}
.forms{
background-color:rgba(0,0,0,0.6);
width:100%;
height:100%;
position:absolute;
top:0;
display:none;
justify-content:center;
align-items:center;
}
.popup
{
height:300px;
width:700px;
background-color:#ffffff;
padding:20px;
border-radius:10px;
position:relative;
}
.form{
background-color:rgba(0,0,0,0.6);
width:100%;
height:100%;
position:absolute;
top:0;
display:none;
justify-content:center;
align-items:center;
}
.popups
{
height:500px;
width:800px;
background-color:#ffffff;
padding:20px;
border-radius:10px;
position:relative;
}
.close
{
position:absolute;
top:-15px;
right:-12px;
height:20px;
width:20px;
border-radius:50%;
cursor:pointer;
}
.for{
background-color:rgba(0,0,0,0.6);
width:100%;
height:100%;
position:absolute;
top:0;
display:none;
justify-content:center;
align-items:center;
}
.po
{
height:300px;
width:400px;
background-color:#ffffff;
padding:20px;
border-radius:10px;
position:relative;
}
.clos
{
position:absolute;
top:-15px;
right:-12px;
height:20px;
width:20px;
border-radius:50%;
cursor:pointer;
}
.closes
{
position:absolute;
top:-15px;
right:-12px;
height:20px;
width:20px;
border-radius:50%;
cursor:pointer;
}
</style>
<div id="header">
<a href="adm.php">Logout</a>
</div>
<div id="right">
<ul><br /><br /><br />
<li><a href="#" class="butt" id="butt">Add Hostel</a>
<li><a href ="#" class="button" id="button">View Register</a></li>
<li><a href ="#" class="buttons" id="buttons">Room Allocation</a></li>
</ul>
</div>
<div class="forms">
<div class="popup">
<img src="close.jpg" class="close">
<center><table border="2">
<tr>
<th>Register number</th>
<th>Student Name</th>
<th>Gender</th>
<th>Contact</th>
<th>Email id</th><th>Room no</th></tr>
<?php
$con=mysqli_connect('localhost','root','','hostel');
if($con->connect_errno)
{
echo $con->connect_erro;
die();
}

$sql="SELECT * FROM Stuprofile";


$result=$con->query($sql);
if($result->num_rows>0)
{
while($row=$result->fetch_assoc())
{
$reg=$row["regno"];

$stu=$row["stuname"];
$gen=$row["gender"];
$con=$row["contact"];
$email=$row["email"];
$room=$row["room"];
echo "<tr><td><a href='room.php?link=$reg'
name='home'>".$reg."</a></td><td>".$stu."</td><td>".$gen."</td><td>".$con."</td><td>".$e
mail."</td><td>".$room."</td></tr>";
}
echo "</table></center>";
}
else
{
echo "0 result";
}
if(isset($_GET['link']))
{
$_SESSION['link']=$_GET['link'];
$reg=$_SESSION['link'];
}
?>
</div>
</div>
<div class="for">
<div class="po">
<img src="close.jpg" class="clos">
<table>
<form method="post">
<tr><td>Hostel Name:</td><td>&nbsp;</td><td><input type="text" name="hstlna"
/></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Room No:</td><td>&nbsp;</td><td><input type="text" required
name="roomno"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Hostel Address</td><td>&nbsp;</td><td><textarea rows="4" cols="30"
name="hstladd" required ></textarea></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td><input type="submit" name="addhstl" value="Add hostel" /></td></tr>
</form>
</table>
<?php
$con=mysqli_connect('localhost','root','','hostel');
if($con->connect_errno)
{
echo $con->connect_erro;
die();
}

if(isset($_POST['addhstl']))
{
$hstlna=$_POST['$hstlna'];
$roomn=$_POST['$roomno'];
$hstladd=$_POST['$hstladd'];
$sql="INSERT INTO rooms(hstlname, roomno, hstladd) VALUES
('$hstlna','$roomn','$hstladd')";
if($con->query($sql))
{
echo '<script>alert("Hostel add successfully")</script>';
}
}
?>

</div>
</div>
<div class="form">
<div class="popups">
<img src="close.jpg" class="closes">
<?php
session_start();
$con=mysqli_connect('localhost','root','','hostel');
if($con->connect_errno)
{
echo $con->connect_erro;
die();
}
$sql="SELECT * FROM stuprofile where regno='$reg'";
$result=$con->query($sql);
if($result->num_rows>0)
{
while($row=$result->fetch_assoc())
{
$regs=$row["regno"];
$stus=$row["stuname"];
$gens=$row["gender"];
$cons=$row["contact"];
$emails=$row["email"];
$cor=$row["courses"];
$adds=$row["address"];
}

}
else
{
echo "0 result";
}
?>
<center><table>
<form method="post">
<tr><td>Register no:</td><td>&nbsp;</td><td><input name="regno" type="text"
readonly="true" value="<?php echo $regs;?>"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Student Name:</td><td>&nbsp;</td><td><input name="stud" type="text"
readonly="true" value="<?php echo $stus;?>"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Gender:</td><td>&nbsp;</td><td><input name="genders" type="text"
readonly="true" value="<?php echo $gens;?>"></td></tr>
<tr><td>&nbsp;</td></tr>

<tr><td>Contact:</td><td>&nbsp;</td><td><input name="conts" type="text" readonly="true"


value="<?php echo $cons;?>"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Email id:</td><td>&nbsp;</td><td><input name="emailids" type="text"
readonly="true" value="<?php echo $emails;?>"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Course:</td><td>&nbsp;</td><td><input name="cors" type="text" readonly="true"
value="<?php echo $cor;?>"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Address:</td><td>&nbsp;</td><td><input name="adds" type="text" readonly="true"
value="<?php echo $adds;?>"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Hostel name:<td>&nbsp;</td><td><input name="hstln" type="text" /></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Room number:<td>&nbsp;</td><td><input name="roo" type="text" /></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Hostel address:<td>&nbsp;</td><td><input name="hstad" type="text" /></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td><input type="submit" name="allo" value="Room allocation"/> </td></tr>
</form>
</table></center>
<?php
$con=mysqli_connect('localhost','root','','hostel');
if($con->connect_errno)
{
echo $con->connect_erro;
die();
}

if(isset($_POST['allo']))
{
$hstlnam=$_POST['$hstln'];
$roomna=$_POST['$roo'];
$hstladdr=$_POST['$hstad'];
$reg=$_POST['regno'];
$sql="INSERT INTO `rooms`(`hstlname`, `roomno`, `hstladd`,`regno`) VALUES
('$hstlnam','$roomna','$hstladdr','$reg')";
if($con->query($sql))
{
echo '<script>alert("Hostel add successfully")</script>';
}
}
?>
</div>
</div>
<script>
document.getElementById("butt").addEventListener("click",function(){document.querySelector(
".for").style.display="flex";
})
document.querySelector(".clos").addEventListener("click",function(){document.querySelector(".
for").style.display="none";
})
document.getElementById("button").addEventListener("click",function(){document.querySelect
or(".forms").style.display="flex";
})
document.querySelector(".close").addEventListener("click",function(){document.querySelector(
".forms").style.display="none";
})
document.getElementById("buttons").addEventListener("click",function(){document.querySelec
tor(".form").style.display="flex";
})
document.querySelector(".closes").addEventListener("click",function(){document.querySelector
(".form").style.display="none";
})
</script>
</body>
</html>

Student Page:

<html>
<head>
</head>
<body>
<style>
#header
{
background:#CCCCCC;
height:28px;
font-size:26px;
width:100%;
}
#header a{
float:right;
}
#right
{
height:100%;
width:300px;
background-color:#FFCCCC;
float:left;
}
#right ul{
margin-top:2%;
}
#right ul li{
max-width:500px;
padding:30px;
}
#right a{
text-align:center;
font-size:26px;
text-decoration:none;
}
#margin{
margin-top:2%;
float:left;
}
.forms{
background-color:rgba(0,0,0,0.6);
width:100%;
height:100%;
position:absolute;
top:0;
display:none;
justify-content:center;
align-items:center;
}
.popup
{
height:500px;
width:800px;
background-color:#ffffff;
padding:20px;
border-radius:10px;
position:relative;
}
.form{
background-color:rgba(0,0,0,0.6);
width:100%;
height:100%;

position:absolute;
top:0;
display:none;
justify-content:center;
align-items:center;
}
.popups
{
height:500px;
width:800px;
background-color:#ffffff;
padding:20px;
border-radius:10px;
position:relative;
}
.close
{
position:absolute;
top:-15px;
right:-12px;
height:20px;
width:20px;
border-radius:50%;
cursor:pointer;
}
.closes
{
position:absolute;
top:-15px;
right:-12px;
height:20px;
width:20px;
border-radius:50%;
cursor:pointer;
}
.for{
background-color:rgba(0,0,0,0.6);
width:100%;
height:100%;
position:absolute;
top:0;
display:none;
justify-content:center;
align-items:center;
}
.po
{
height:400px;
width:400px;
background-color:#ffffff;
padding:20px;
border-radius:10px;
position:relative;
}
.clos
{
position:absolute;
top:-15px;
right:-12px;
height:20px;
width:20px;
border-radius:50%;
cursor:pointer;
}
#table
{
padding:20px;
}
#mydiv
{
width:70%;
display:none;
padding:20px;
background-color:#FFFF99;
}
</style>
<?php
session_start();
?>
<div id="header">
Hi <?php echo $_SESSION["regnos"];?>
<a href="hostel.php">Logout</a>
</div><div id="container"></div>

<div id="right">
<ul><br /><br /><br />
<li><a href="#">My profile</a><button onClick="myfunction()">+</button></li>
<div id="mydiv">
<li><a href ="#" class="button" id="button">Add profile</a></li>
<li><a href ="#" class="buttons" id="buttons">View profile</a></li></div>
<li><a href ="#" >Facilities</a></li>
<li><a href ="#" class="but" id="but">Room Detail</a></li>
</ul>
</div>

<div class="forms">
<div class="popup">
<img src="close.jpg" class="close">
<?php
$con=mysqli_connect('localhost','root','','hostel');
if($con->connect_errno)
{
echo $con->connect_erro;
die();
}
?>
<?php
$regnos=$_SESSION["regnos"];
$con=mysqli_connect('localhost','root','','hostel');
if($con->connect_errno)
{
echo $con->connect_erro;
die();
}
$sql="SELECT * FROM registration where regno='$regnos'";
$result=$con->query($sql);
if($result->num_rows>0)
{
while($row=$result->fetch_assoc())
{
$reg=$row["regno"];
$stu=$row["stuname"];
$gen=$row["gender"];

$con=$row["contact"];
$email=$row["emailid"];
}
}
else
{
echo "0 result";
}
?>
<p><b>Add Personal details:</b></p>
<center><table id="table" cellspacing="10px" cellpadding="5px">
<form method="post">
<tr><td>Register no:</td><td>&nbsp;</td><td><input name="regnum" type="text"
value="<?php echo $reg;?>"></td></tr>
<tr><td>Student Name:</td><td>&nbsp;</td><td><input name="stud" type="text"
readonly="true" value="<?php echo $stu;?>"></td></tr>
<tr><td>Gender:</td><td>&nbsp;</td><td><input name="gend" type="text" readonly="true"
value="<?php echo $gen;?>"></td></tr>
<tr><td>Contact:</td><td>&nbsp;</td><td><input name="cont" type="text" readonly="true"
value="<?php echo $con;?>"></td></tr>
<tr><td>Email id:</td><td>&nbsp;</td><td><input name="emailids" type="text"
value="<?php echo $email;?>"></td></tr>
<tr><td>Courses:</td><td>&nbsp;</td><td><select name="c"><option
value="MCA">MCA</option><option value="ME">ME</option><option
value="BE">BE</option></select></td></tr>
<tr><td>Address:</td><td>&nbsp;</td><td><textarea rows="5" cols="50"
name="address"></textarea></td></tr>
<input type="text" name="room">
<tr><td><input type="submit" name="sub" value="Add profile"></td></tr>
</form>
</table></center>
<?php
$con=mysqli_connect('localhost','root','','hostel');
if($con->connect_errno)
{
echo $con->connect_erro;
die();
}

if(isset($_POST["sub"]))
{
$regnum=$_POST['regnum'];
$stud=$_POST['stud'];
$gend=$_POST['gend'];
$cont=$_POST['cont'];
$emailids=$_POST['emailids'];
$c=$_POST['c'];
$room=$_POST['room'];
$address=$_POST['address'];
try{
if(mysqli_query($con,"insert into stuprofile (`regno`, `stuname`, `contact`, `email`, `address`,
`gender`, `courses`) values ('$regnum','$stud','$cont','$emailids','$address','$gend','$c')")) {
echo '<script>alert("Add profile successfully")</script>';
}
else
{

echo "invalid";
}
}
catch(Exception $ex){echo 'message'.$ex->getMessage();}
}
?>
</div>
</div>
<div class="form">
<div class="popups">
<img src="close.jpg" class="closes">
<p><b>View Personal details:</b></p>
<center><table id="table" cellspacing="10px" cellpadding="5px">
<?php
$con=mysqli_connect('localhost','root','','hostel');
if($con->connect_errno)

{
echo $con->connect_erro;
die();
}
$regnos=$_SESSION["regnos"];
$sql="SELECT * FROM stuprofile where regno='$regnos'";
$result=$con->query($sql);
if($result->num_rows>0)
{
while($row=$result->fetch_assoc())
{
$regs=$row["regno"];
$stus=$row["stuname"];
$gens=$row["gender"];
$cons=$row["contact"];
$emails=$row["email"];
$cor=$row["courses"];
$adds=$row["address"];
}

}
else
{
echo "0 result";}?>

<form>
<tr><td>Register no:</td><td>&nbsp;</td><td><input name="regno" type="text"
readonly="true" value="<?php echo $regs;?>"></td></tr>
<tr><td>Student Name:</td><td>&nbsp;</td><td><input name="stud" type="text"
readonly="true" value="<?php echo $stus;?>"></td></tr>
<tr><td>Gender:</td><td>&nbsp;</td><td><input name="genders" type="text"
readonly="true" value="<?php echo $gens;?>"></td></tr>
<tr><td>Contact:</td><td>&nbsp;</td><td><input name="conts" type="text" readonly="true"
value="<?php echo $cons;?>"></td></tr>
<tr><td>Email id:</td><td>&nbsp;</td><td><input name="emailids" type="text"
readonly="true" value="<?php echo $emails;?>"></td></tr>
<tr><td>Course:</td><td>&nbsp;</td><td><input name="emailids" type="text"
readonly="true" value="<?php echo $cor;?>"></td></tr>
<tr><td>Email id:</td><td>&nbsp;</td><td><input name="emailids" type="text"
readonly="true" value="<?php echo $adds;?>"></td></tr>
</form>
</table></center>
</div></div>
<script>
document.getElementById("button").addEventListener("click",function(){document.querySelect
or(".forms").style.display="flex";
})
document.querySelector(".close").addEventListener("click",function(){document.querySelector(
".forms").style.display="none";
})
document.getElementById("buttons").addEventListener("click",function(){document.querySelec
tor(".form").style.display="flex";
})
document.querySelector(".closes").addEventListener("click",function(){document.querySelector
(".form").style.display="none";
})
document.getElementById("but").addEventListener("click",function(){document.querySelector(
".for").style.display="flex";
})
document.querySelector(".clos").addEventListener("click",function(){document.querySelector(".
for").style.display="none";
})
</script>

<script>
function myfunction(){
var x=document.getElementById("mydiv");
if(x.style.display==="none")
{

x.style.display="block";
}
else
{
x.style.display="none";
}

}
</script>
<div class="for">
<div class="po">
<img src="close.jpg" class="clos">

<?php
$con=mysqli_connect('localhost','root','','hostel');
if($con->connect_errno)
{
echo $con->connect_erro;
die();
}

$regnos=$_SESSION["regnos"];
$sql="SELECT * FROM stuprofile where regno='$regnos'";
$result=$con->query($sql);
if($result->num_rows>0)
{
while($row=$result->fetch_assoc())
{
$regs=$row["regno"];
$stus=$row["stuname"];
$gens=$row["gender"];
$cons=$row["contact"];
$emails=$row["email"];
$cor=$row["courses"];
$adds=$row["address"];
}
}
else
{
echo "0 result";
}
$sqli="SELECT * FROM room where regno='$regnos'";
$res=$con->query($sqli);

if($res->num_rows>0)

{
while($row=$res->fetch_assoc())
{
$room=$row["room"];
}
}
else
{
echo "no room allocate";
}
?>
<center><table>
<form method="post">
<tr><td>Register no:</td><td>&nbsp;</td><td><input name="regno" type="text"
readonly="true" value="<?php echo $regs;?>"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Student Name:</td><td>&nbsp;</td><td><input name="stud" type="text"
readonly="true" value="<?php echo $stus;?>"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Gender:</td><td>&nbsp;</td><td><input name="genders" type="text"
readonly="true" value="<?php echo $gens;?>"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Contact:</td><td>&nbsp;</td><td><input name="conts" type="text" readonly="true"
value="<?php echo $cons;?>"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Email id:</td><td>&nbsp;</td><td><input name="emailids" type="text"
readonly="true" value="<?php echo $emails;?>"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Course:</td><td>&nbsp;</td><td><input name="cors" type="text" readonly="true"
value="<?php echo $cor;?>"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Address:</td><td>&nbsp;</td><td><input name="adds" type="text" readonly="true"
value="<?php echo $adds;?>"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>Hostel name:<td>&nbsp;</td><td><input name="hstln" type="text" value="<?php
echo $room;?>" /></td></tr>
</div>
</div>
</body>
</html>

Result:
Thus the Hostel Management System online application was successfully executed and
the output was verified.
Registration:

Add Profile:
View Profile:

Room Detail:
Admin Login:

Add Room:
View user details:

Room Allocate:

You might also like