DFP50193
WEB PROGRAMMING
TOPIC CHAPTER 2: PHP PROGRAMMING
ASSESSMENT LABORATORY TASK 2
NAME MOHAMMAD RADIUDDIN BIN MOHD AZHAR
REG NO 13DDT20F2070
PROGRAMME DDT5S1
LECTURER RISLAH BINTI ZAKRIA
INSTRUCTIONS :
1. Answer ALL the questions
MARKING SCHEME
CLO 1(P) PLO 3 /20
TOTAL /20
THE ENTIRE QUESTION IS BASED ON JTMK’S QUESTION BANK APPROVED BY
PROGRAMME LEADER.
SIGNATURE IS NOT REQUIRED.
LABORATORY TASK 2:
Chapter 2 – PHP Programming
Instructions:
Answer all questions. Be submitted in the form of softcopy
Comment your code! Trust me it’s worth the extra effort.
Indent your code to increase clarity.
LEARNING OUTCOME
Students should be able to create and manipulate web forms in PHP and display the output
appropriately.
Questions:
1. Create a program to help juries on calculating mark of competition in SK Batu 7.You
may choose either Singging / Colouring / Painting competition.
2. The content of your form is about to fill in data about participant such as name,
class, date and jury name. Your program must able to accept input of participants,
mark for each criteria obtain by participant. Apply validation for each input.
3. Define the award of each participant based on table 1
Mark Range Award
80 - 100 Gold
65 – 79 Silver
50- 64 Bronze
< 50 No Awards
Table 1
4. Your code must using control structure and array in PHP environment.
5. Design your form with appropriate layout. Your pages must runs perfectly as well as
the suitability of the page. Preview your output as honor / participation certificate .
6. Submit your work in report and PHP format file in google classroom.
-END-
Html :
<html>
<head>
<title>Competition Marks Calculation</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<img src="sk7.jpg">
<table>
<h1>Competition Marks Calculation</h1>
<form method="post" action="calculatemark.php">
<tr><td><label>Name:</label>
<input type="text" name="name" required><br><br></td></tr>
<tr><td><label>Class:</label>
<input type="text" name="class" required><br><br></td></tr>
<tr><td><label>Date:</label>
<input type="date" name="date" required><br><br></td></tr>
<tr><td><label>Jury Name:</label>
<input type="text" name="jury_name" required><br><br></td></tr>
<tr><td><label>Singing:</label>
<input type="number" name="singing" min="0" max="100"
required><br><br></td></tr>
<tr><td><label>Content:</label>
<input type="number" name="content" min="0" max="100"
required><br><br></td></tr>
</table>
<input type="submit" value="Calculate Marks">
</form>
</body>
</html>
PHP :
<img src="sk7.jpg">
<?php
$name = $_POST['name'];
$class = $_POST['class'];
$date = $_POST['date'];
$jury_name = $_POST['jury_name'];
$singing = $_POST['singing'];
$content = $_POST['content'];
$marks = array(
'singing' => $singing,
'content' => $content,
);
$total_marks = $singing + $content;
if ($total_marks >= 80) {
$award = "Gold";
} else if ($total_marks >= 65) {
$award = "Silver";
} else if ($total_marks >= 50) {
$award = "Bronze";
} else {
$award = "No Awards";
}
echo "<h1>Certificate of Participation</h1>";
echo "<p>Name: " . $name . "</p>";
echo "<p>Class: " . $class . "</p>";
echo "<p>Date: " . $date . "</p>";
echo "<p>Jury Name: " . $jury_name . "</p>";
echo "<p>Total Marks: " . $total_marks . "</p>";
echo "<p>Award: " . $award . "</p>";
echo "</body></html>";
?>
CSS :
table {
border-collapse: collapse;
margin-bottom: 10px;
}
td {
border: 1px solid black;
padding: 5px;
}
OUTPUT :
RUBRIC FOR LABORATORY TASK 2
Excellent Good Fair Poor
Criteria Mark Weightage Scoring
4 3 2 1
GUI minimally meets
GUI generally meets
GUI is as specified the specifications, GUI is incomplete / 4 * 20
Graphical User the specifications
and is natural to the does not increase the and does not meet 4 20%
Interface and is acceptable to
user. usability of the specifications =
the user.
program.
PHP code is
PHP code is well organized, almost PHP code is organized, PHP code is
/ 4 * 15
organized, well complete contain one comment, disorganized, no
Coding Standard 4 15%
written comments, comments, inconsistent comments, no
=
proper indentation. inconsistent indentation. indentation.
indentation.
PHP code apply PHP code contain only
Programming / 4 * 20
conditional PHP code apply one conditional PHP code not apply
Technique
statement (if, almost conditional statement (if, if..else, conditional
- Conditional 4 20% =
if..else, for while, statement and while, and do…while). statement execute
Statement
and do…while) and execute successfully and execute with errors
execute successfully successfully
PHP code PHP code / 4 * 20
PHP code successfully
Programming successfully apply successfully apply PHP code not
apply array to view at
Technique array to view at least array to view at successfully apply 4 20% =
least 1-2 criteria for
- Array 4 criteria for least 3 criteria for array
competition
competition competition
Executes Executes Executes successfully
Can’t be execute.
successfully with successfully with but sometimes / 4 * 25
Execution and Provide too many
CORRECT and CORRECT but not provides errors with 4 25%
Output errors with no
PRECISE output PRECISE output hesitant output =
output displayed.
TOTAL 100% / 100