k1
k1
<html>
<body>
<br><center><h1><u><font color="red">PALINDROME</font></u></h1></center>
<tr><td><br><br><center><br><br>
<br><br><br></center></tr></td></table>
</form>
<?php
if($_POST)
$n1=$_POST["n"];
$p=$n1;
$s=0;
while($n1>=1)
{
$r=$n1%10;
$n1=$n1*(10/100);
$s=$s*10+$r;
if($p==$s)
else
echo'</font>';
echo'</td></tr></table>';
?>
</body>
</html>
OUTPUT:
Course Code: CSA2009
Course Title: Web 2.0
Lab sheet 2 - Module 1
Problem Statement:
Program
To open a file
<!DOCTYPE html>
<html>
<body>
<?php
$myfile=fopen("webdictionary.txt", "r") or die("Unable to open file!");
echo fread($myfile,filesize("webdictionary.txt"));
fclose($myfile);
?>
</body>
</html>
To write a file
<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "John William\n";
fwrite($myfile, $txt);
$txt = "John Smith\n";
fwrite($myfile, $txt);
fclose($myfile);
?>
To append a file and close file.
<?php
$myfile = fopen("newfile.txt", "a") or die("Unable to open file!");
$txt = "Donald Duck\n";
fwrite($myfile, $txt);
$txt = “Harshith\n";
fwrite($myfile, $txt);
fclose($myfile);
?>
Output
webdictionary.txt
AJAX = Asynchronous JavaScript and XML
CSS = Cascading Style Sheets
HTML = Hyper Text Markup Language
PHP = PHP Hypertext Preprocessor
SQL = Structured Query Language
SVG = Scalable Vector Graphics
XML = EXtensible Markup Language
To open a file
To write a file
John William
John Smith
To append a file and close file.
John William
John Smith
Donald Duck
Harshith
Course Code: CSA2009
Course Title: Web 2.0
Lab sheet 3 - Module 1
Problem Statement:
Write a PHP MYSQL program to collect the student data and store in Server database.
a. Student Name, Roll_no, mail_id, mobile_no, gender, city, state and
department - Minimum 4 students records to insert.
b. Display the student’s details
b. Update the student’s details
c. Delete the student Record from database.
Registaration.html
<!DOCTYPE html>
<html lang="en-us">
<head> <title>Responsive Registaration Form</title></head>
<body>
<h1>Student Registaration Form</h1>
<form class="srf" action="http://localhost/insertdb.php" method="post">
<br><br>Roll No:<input type="text" id="rollno" name="rollno" >
<br><br>Student Name:<input type="text" id="name" name="name" >
<br><br>Email:<input type="email" id="email" name="email" >
<br><br>Mobile:<input type="tel" id="mobile" name="mobile" >
<br><br>Gender:<input type="radio" id="male" name="gender" value="male"/>Male
<input type="radio" id="female" name="gender" value="female"/>Female
<br><br>City:<input type="text" id="city" name="city" maxlength="10">
<br><br>State:<input type="text" id="state" name="state">
<br><br>Specialization:<br><br>
<input type="checkbox" name="specialization" value="Computer Science">Computer
Science<br/>
<input type="checkbox" name="specialization" value="Information
Technology">Information Technology<br/>
<input type="checkbox" name="specialization" value="Computer
Architecture">Computer Architecture<br/>
<input type="checkbox" name="specialization" value="Tele Communication">Tele
Communication<br/>
<br><br><input type="submit" value="Register" onclick="SaveStudentDetails()">
</form>
</body>
</html>
</body>
</html>
insertdb.php
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "ls9_srf"; // DB Name
updatedb.php
<?php
$servername = "localhost";
$username = "root";
$password = "";
// Create connection
// Check connection
if (!$conn) {
if (mysqli_query($conn, $sql)) {
} else {
mysqli_close($conn);
?>
Deletedb.php
<?php
$servername = "localhost";
$username = "root";
$password = "";
// Create connection
// Check connection
if (!$conn) {
}
$sql = "DELETE FROM srf WHERE Roll_No='20201CSE0004'";
$conn->close();
?>
OUTPUT
Registration from
Write a PHP script with MYSQL to display the employee data for following criteria.
a. Create the database with Minimum 5 employee records like (Id(primary key),
name, department and salary).
b. Create HTML page to search employee data using Id and Salary.
Step 2: create a new php file filename.php and place the php file in C:/xampp /
htdocs folder (accommodate required statements to establish connection with
your database)
Search.html
<!DOCTYPE html>
<html lang="en-us">
<head> <title>Employee Details</title> </head>
<body>
<h1>Employee Details</h1>
<form class="emp" action="http://localhost/dbdisplay.php"
method="post">
<br><h3>Search Employee Details Based on Employee ID</h3>
<br>Enter Employee ID:<input type="number" id="Id" name="Id" >
<br><br><input type="submit" value="Search"
onclick="SaveEmpDetails()">
</form>
Searchdb.php
<?php
$servername = "localhost"; // default
$username = "root"; // root is a username
$password = ""; // No password for my db that why it is blank
$dbname = "Employee"; // mydb is my db name
// Create connection
// Check connection
if (!$conn) {
die("Connection failed: " . mysql_connect_error());
}
// Query Processing
if($_POST["Id"]!=0) // search using ID
{
$v1=$_POST["Id"];
$sql = "SELECT * from emp where Id=$v1";
}
else // search using salary
{
$v2=$_POST["SS"];
$v3=$_POST["LS"];
$sql = "SELECT * from emp where Salary between $v2 AND $v3";
}
// Result processing
if (mysqli_num_rows($result) > 0)
{
// output data of each row
while($row = mysqli_fetch_array($result))
{
print "Employee ID: " . $row["Id"]."<br><br>";
print "Employee Name: " . $row["Name"]."<br><br>";
print "Employee Department: " . $row["Dept"]."<br><br>";
print "Employee Salary: " . $row["Salary"]."<br><br>";
print "*********************" ."<br><br>";
}
}
else
{
echo "0 results";
}
Develop a XML program to store book details like title, author, publication, year, price
etc. using CSS.
Solution
Books.xml
books {
color: white;
background-color : gray;
width: 100%;
}
heading {
color: green;
font-size : 40px;
background-color : powderblue;
}
heading, title, author, publisher, edition, price {
display : block;
}
title {
font-size : 25px;
font-weight : bold;
}
OUTPUT
Course Code: CSA2009
Course Title: Web 2.0
Lab sheet 6 - Module 2
Problem Statement:
Write an XSL style sheet for an XML document consisting of details about the
shopping cart purchase list with 50gms of Badam, 100gms of Cashew nuts, 150gms of
coffee powder, 250gms of salt, 500gms of Dhal, 750 liter of oil and 1000gms of sugar
and displays the document about shopping cart information in an HTML table.
Solution
Product.xml
Displayproduct.xsl
OUTPUT
7. Write a HTML and J Query program to create a webpage to fetch
the details of the event and display the invitation.
<html>
<head>
<title>Create Invitation</title>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$(document).ready(function(){
$("#create").click(function(){
var b = $("#bride").val();
var bg =
$("#bridegroom").val();
var q =
$("#quotes").val();
var v = $("#venue").val();
var d = $("#date").val();
$(".input").hide();
$("*").css("background-color","violet");
$("h3").css("background-color","blue");
$("#content,#destination").css("background-color","pink");
$("h3").html(b + " &" + bg + " Cordially Invites You");
$("#content").html(q);
$("#destination").html("@ " + v + " on " + d);
});
});
</script>
</head>
<body>
<center>
<div class="input">
<h2>Create Your Invitation</h2>
<p>Bride : <input type="text" id="bride" value="" /> </p>
<p>Bridegroom : <input type="text" id="bridegroom" value="" /> </p>
<p>Quotes : <input type="text" id="quotes" value="" /> </p>
<p>Venue : <input type="text" id="venue" value="" /> </p>
<P>Date : <input type="text" id="date" value="" /> </P>
<button id="create">Create</button>
</div>
<div id="invitation">
<h3></h3>
<p id="content"></p>
<p id="destination"></p>
</div>
</center>
</body>
</html>
8. Write a HTML and JQuery program to design a webpage to accept
event organizer name from the user and display it on the webpage.
Program:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script>
$(document).ready(function
(){
$("#display").click(function(
){
var name = $("#eventOrganizer").val();
$("#result").html("Organizer Name :" + name);
});
});
</script>
</head>
<body style="background-color:pink">
<center>
<h2>Event Organization</h2>
<p>Event Organizer : <input id="eventOrganizer" type="text" value=""/></p>
<button id="display">Display</button>
<div id="result"></div>
</center>
</body>
</html>
Course Code: CSA2009
Course Title: Web 2.0
Lab sheet 9 - Module 3
Problem Statement:
You are tasked with developing a Student Marks Management System using AngularJS. The system should
allow teachers to enter, view, edit, and delete student marks details stored in a table format.
StudentsMarks.html
<!DOCTYPE html>
<html lang="en" ng-app="studentMarksApp">
<head>
<meta charset="UTF-8">
<title>Student Marks Management System</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>
<script src="StudentMarks.js"></script>
</head>
<body ng-app="studentMarksApp" ng-controller="StudentMarksController as vm">
<h1>Student Marks Management System</h1>
<label for="name">Name:</label>
<input type="text" id="name" ng-model="vm.newMark.name" required><br>
<label for="subject">Subject:</label>
<input type="text" id="subject" ng-model="vm.newMark.subject" required><br>
<label for="marks">Marks Obtained:</label>
<input type="number" id="marks" ng-model="vm.newMark.marks" required><br>
angular.module('studentMarksApp', [])
.controller('StudentMarksController', function() {
var vm = this;
vm.studentMarks = [
{ studentId: '1', name: 'John', subject: 'Math', marks: 90 },
{ studentId: '2', name: 'Alice', subject: 'Science', marks: 85 },
{ studentId: '3', name: 'Bob', subject: 'English', marks: 75 }
];
vm.newMark = {};
vm.addStudentMark = function() {
vm.studentMarks.push(vm.newMark);
vm.newMark = {};
};
vm.editStudentMark = function(mark) {
vm.newMark = angular.copy(mark);
};
vm.deleteStudentMark = function(mark) {
var index = vm.studentMarks.indexOf(mark);
vm.studentMarks.splice(index, 1);
};
});
Course Code: CSA2009
Course Title: Web 2.0
Lab sheet 10 - Module 3
Problem Statement:
You are tasked with building an Employee Management System using AngularJS. The system
should allow administrators to view, add, edit, and delete employee records stored in a table
format.
Employeedetails.html
<!DOCTYPE html>
<html lang="en" ng-app="employeeManagementApp">
<head>
<meta charset="UTF-8">
<title>Employee Management System</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>
<script src="Employeedetails.js"></script>
</head>
<body ng-controller="EmployeeController as vm">
<h1>Employee Management System</h1>
<label for="name">Name:</label>
<input type="text" id="name" ng-model="vm.newEmployee.name" required><br>
<label for="department">Department:</label>
<input type="text" id="department" ng-model="vm.newEmployee.department" required><br>
<label for="position">Position:</label>
<input type="text" id="position" ng-model="vm.newEmployee.position" required><br>
Employeedetails.js
angular.module('employeeManagementApp', [])
.controller('EmployeeController', function() {
var vm = this;
vm.employees = [
{ employeeId: '1', name: 'John Doe', department: 'HR', position: 'Manager' },
{ employeeId: '2', name: 'Alice Smith', department: 'Finance', position: 'Accountant' },
{ employeeId: '3', name: 'Bob Johnson', department: 'IT', position: 'Developer' }
];
vm.newEmployee = {};
vm.addEmployee = function() {
vm.employees.push(vm.newEmployee);
vm.newEmployee = {};
};
vm.editEmployee = function(employee) {
vm.newEmployee = angular.copy(employee);
};
vm.deleteEmployee = function(employee) {
var index = vm.employees.indexOf(employee);
vm.employees.splice(index, 1);
};
});