21.2 Web Answers
21.2 Web Answers
INDEX NUMBER 22795 YEAR OF STUDY AND 1st year 2nd semester
(NSBM) SEMESTER
GRADE/MARK
COMMENTS
Declaration
I hereby certify that the statements I have attested to above have been made in good faith and are true
and correct. I also certify that this is my own work and I have not plagiarized the work of others and
not participated in collusion.
01. a
02. d
03. a
04. d
05. c
06. b
07. c
08. b
09. d
10. a
11. a
12. c
13. d
14. b
15. c
Part B
Question 01)
a)
Login.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div class="header">
<h2>Login</h2>
</div>
<div class="container">
<option value="student">Student</option>
<option value="staff">Staff</option>
</select><br>
<label for="text"><b>USN</b></label>
<label for="psw"><b>Password</b></label>
</div>
</form>
</body>
</html>
style.css
*{
margin: 0;
padding: 0;
body{
input[type=text], input[type=password]{
width: 100%;
margin: 8px 0;
display: inline-block;
box-sizing: border-box;
button {
background-color: #4fb33b;
color: white;
border: none;
cursor: pointer;
width: 100%;
.dropdown{
width: 100%;
margin: 8px 0;
display: inline-block;
box-sizing: border-box;
.header{
background-color: #04AA6D;
height: 120px;
h2{
padding-top: 30px;
padding-left: 20px;
color: #fff;
p{
padding-top: 3px;
padding-left: 20px;
color: #fff;
.login-form{
width: 50%;
background-color: #f0f5f5;
.cancelbtn {
width: auto;
background-color: #f44336;
.container {
padding: 16px;
span.psw {
float: right;
padding-top: 2px;
}
b)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
</body>
</html>
c)
i. ,ii. , iii.
<script>
function validateform() {
var pw = document.getElementById("psw").value;
if(pw == "") {
return false;
if(pw.length < 6)
return false;
else
alert("Password is correct");
}
if(document.loginform.Login.value == "")
</script>
Question 02)
a)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Question 02</title>
</head>
<body>
<style type="text/css">
div {
width: 50%;
padding: 10px;
margin: 0;
h1{
text-align: center;
font-weight: bold;
text-decoration-line: underline;
p{
text-align: justify;
font-family: Garamond;
}
h4{
color: blue;
font-family: Arial;
</style>
<div>
<h4>0115445000</h4>
</div>
</body>
</html>
b)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<button onclick="myFunction()">Button</button>
<script>
function myFunction() {
alert("This is a alert!");
</script>
</body>
</html>
c)
<!DOCTYPE html>
<html>
<head>
<title> </title>
</head>
<body>
<button onclick="myFunction()">Button</button>
<p id="answer"></p>
<script>
function myFunction() {
let arae;
area = height*width;
</script>
</body>
</html>
Question 03)
a)b)c)
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<table>
<tr>
<td>Name</td>
</tr>
<tr>
<td>Sex</td>
</tr>
<tr>
<td>Address</td>
</tr>
<tr>
<td>Age</td>
<tr>
<td><button type="submit">Ok</button></td>
<td><button type="reset">Cancel</button></td>
</tr>
</table>
</form>
<?php
$name = $_GET["name"];
$male = $_GET["male"];
$female = $_GET["female"];
$address = $_GET["address"];
$age = $_GET["age"];
if (sex_1=="male"){
else{
?>
</body>
</html>
b.
<html>
<body>
<table>
<tr>
<td>Employee Number</td>
</tr>
<tr>
<td>New Salary</td>
</tr>
<tr>
<td><button type="reset">Cancel</button></td>
</tr>
</table>
</form>
<?php
$emp_num=_name = $_POST["emp_name"];
$new_sal = $_POST["new_sal"];
$user = 'root';
$pass = '';
$db = 'Employee';
$connection = new $mysqli('localhost', $user, $pass, $db);
?>
</body>
</html>
c.
<?php
$user = 'root';
$pass = '';
$db = 'Employee';
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result_Emp)) {
echo "Employee Number: " . $row["Emp_no"]. " --- Salary: " . $row["Salary"].
" <br/>";
}
}
else {
mysqli_close($connection);
?>