PHP Solutions Slip 24 To Slip 26

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Slip24.

html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title></title>
</head>
<body>
<form action="slip24.php" method="post">
<table>
<tr>
<td>Username :-</td>
<td><input type="text" name="user"/></td>
</tr>
<tr>
<td>Password :-</td>
<td><input type="password" name="pass"/></td>
</tr>
<tr>
<td><input type="submit" value="Show"/></td>
</tr>
</table>
</form>
</body>
</html>

Error.php
<?php
session_start();
echo "<h1>You Entered correct Username & Password three
times</h1>";
session_unset();
session_destroy();
?>
Second.php
<?php
echo "Welcome!!!!!!!!!!";
?>
Slip25.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title></title>
</head>
<body>
<?php
include 'db.php';
if($con)
{
$queryInsert="insert into tblemp
(emp_name,address,phone,salary)
values('Mahesh','Pune','9675432189','10000')";
if(mysqli_query($con,$queryInsert))
{
$querySelect="select emo_no from tblemp order by emo_no
desc";
$res=mysqli_query($con,$querySelect);
if($result=mysqli_fetch_array($res))
{
$emp_no=$result['emo_no'];
$q1Dept="insert into tbldept (emp_no,dept_name,location)
values
('$emp_no','BCS','BMT')";
if(mysqli_query($con,$q1Dept))
{
$q1Sal="insert into tblsalary (emp_no,basic,hra,da,ta) values
('$emp_no',1000,200,100,15)";
if(mysqli_query($con,$q1Sal))
{
echo "All Records Inserted Successfully";
}
else
{
echo "Error while Inserting Department Values";
}
}
else
{
echo "Error while Inserting Department Values";
}
}
else
{
echo "Not Found";
}
}
else
{
echo "Error in Employee";
}
}
else
{
echo "Connection Failed";
}
?>
</body>
</html>
db.php
<?php
$con=mysqli_connect("localhost","root","","dbslip25");
?>

Slip26.php
<?php
include 'db.php';
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title></title>
</head>
<body>
<form action="showDoctors.php" method="post">
<table>
<tr>
<td>Select Hospital Name</td>
<td>
<select name="hname">
<?php
$querySelect="select hosp_no,hosp_name from
tblhospital";
$res=mysqli_query($con,$querySelect);
while($row=mysqli_fetch_array($res))
{
?>
<option value="<?php echo $row['hosp_no'];
?>"><?php echo
$row['hosp_name']; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Show Doctors Details"/>
</td>
</tr>
</table>
</form>

</body>
</html>
Showdoctors.php
<?php
include 'db.php';
$hno=$_POST['hname'];
$queryDoctor="select doc_name,address,city,area
from tblhospital as h,tbldoctor as d,tbldh as
dh where h.hosp_no=dh.hosp_no and
d.doc_no=dh.doc_no and h.hosp_no='$hno'";
$res=mysqli_query($con,$queryDoctor);
?>
<table border=1 width="100%">
<tr>
<th>Doctor Name</th>
<th>Address</th>
<th>City</th>
<th>Area</th>
</tr>
<?php
while($row=mysqli_fetch_array($res))
{
?>
<tr>
<td><?php echo $row['doc_name']; ?></td>
<td><?php echo $row['address']; ?></td>
<td><?php echo $row['city']; ?></td>
<td><?php echo $row['area']; ?></td>
</tr>
<?php
}
?>
</table>

db.php
<?php
$con=mysqli_connect("localhost","root","","d
bslip26");
?>

You might also like