Experiment 9 dbms[1]
Experiment 9 dbms[1]
1 System 1
create db.php
<?php
$servername = "localhost"; // Your server name
$username = "root"; // Your database username
$password = "saptarshi@11"; // Your database password
$dbname = "G1101"; // Your database name
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_err
die("Connection failed: " . $conn->connect_error);
}
?>
create employee.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Employee Form</title>
</head>
<body>
<h2>Employee Form</h2>
<form action="process_employee.php" method="post">
<label for="empName">Employee Name:</label>
<input type="text" id="empName" name="empName" required><br>
<label for="age">Age:</label>
<input type="number" id="age" name="age" required><br>
<label for="address">Address:</label>
<input type="text" id="address" name="address" required><br>
Create process_employee.php
<?php
include 'db.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$empName = $_POST['empName'];
$age = $_POST['age'];
$address = $_POST['address'];
$dob = $_POST['dob'];
$phoneNo = $_POST['phoneNo'];
$conn->close();
?>
Create procees_salary.php
<?php
include 'db.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$empId = $_POST['empId'];
$department = $_POST['department'];
$designation = $_POST['designation'];
$basicSal = $_POST['basicSal'];
$conn->close();
?>
Create salary_form.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Salary Form</title>
</head>
<body>
<h2>Salary Form</h2>
<form action="process_salary.php" method="post">
<label for="empId">Employee ID:</label>
<input type="number" id="empId" name="empId" required><br>
<label for="department">Department:</label>
<input type="text" id="department" name="department" required><br>
<label for="designation">Designation:</label>
<input type="text" id="designation" name="designation" required><br>
Output:-
iii. Further, design should have features to edit the salary components as per database design
and calculate the Gross Salary of employee using it.
iv. Basic project should contain required design forms with features to support step ii and iii
respectively.
General Formula for Salary Components and Salary Calculation could be used as:
HRA = 30% of Basic
DA = 10% of Basic
PF = 3% of Basic
Other Allowances as per designation
(Gross Salary = Basic + HRA + DA + PF + Other Allowances (if any))