Partc Iot
Partc Iot
MANOHARA S
20191CSE0318
7CSE06
PARTC
1)
<?php
$servername = "localhost";
$username = "your_username";
$password = "your_password";
$dbname = "Startech";
// Create connection
// Check connection
if ($conn->connect_error) {
?>
B). Insert 6 Employee information into the EMPLOYEE table received through web page.
Validate the Emp Mail ID and Mobile number(only 10 digits) using Javascript
<html>
20191CSE0318
<head>
<script>
function validateForm() {
if (empID == "") {
return false;
if (empName == "") {
return false;
if (empMail == "") {
return false;
if (address == "") {
return false;
20191CSE0318
return false;
if (salary == "") {
return false;
<?php
$sql = "INSERT INTO EMPLOYEE (EmpID, EmpName, EmpMailID, Address, MobileNumber, Salary)
} else {
?>
</script>
</head>
<body>
20191CSE0318
</form>
</body>
</html>
C). Display records of all employees against table columns (Emp Name, Address, Mobile
Number, Salary fields) to the browser page by retrieving from the EMPLOYEE table.
<?php
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "Emp Name: " . $row["EmpName"]. " - Address: " . $row["Address"]. " - Mobile Number: " .
$row["MobileNumber"]. " - Salary: " . $row["Salary"]. "<br>";
}
20191CSE0318
} else {
$conn->close();
?>
D). Make a provision to UPDATE Mobile number and Salary of any one existing employee
through webpage.
E). Demonstrate how to DELETE any Employee details having salary more than 50000.
<?php
} else {
$conn->close();
?>
<html>
<body>
<form>
20191CSE0318
</form>
<p id="demo"></p>
<script>
function sendRequest()
xhr.send();
xhr.onreadystatechange = function() {
document.getElementById("demo").innerHTML = xhr.responseText;
};
</script>
</body>
</html>
20191CSE0318
Wish.php:
<?php
$empID = $_GET['empID'];
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
$empName = $row["EmpName"];
$workAnniversary = $row["WorkAnniversary"];
echo "Happy Work Anniversary, $empName! Today, $workAnniversary, marks another year of your hard
work and dedication. Keep up the good work!";
} else {
$conn->close();
?>