Skip to content

Commit

Permalink
files for assignment lab 5a
Browse files Browse the repository at this point in the history
  • Loading branch information
archie1345 committed Dec 8, 2024
0 parents commit 3a5c215
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
38 changes: 38 additions & 0 deletions lab5a_q1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Lab 5a Q1</title>
</head>
<body>
<?php
$name = "Archie Saskara";
$matricNum = "JI240006";
$course = "BIC21203";
$yearOfStudy = 2023;
$address = "Jl. Bukit Hijau Kav.117"
?>
<table border='1' cellspacing='0' cellpadding='5'>
<tr>
<td>Name: </td>
<td><?php echo "$name"; ?></td>
</tr>
<tr>
<td>Matrics Number: </td>
<td><?php echo "$matricNum"; ?></td>
</tr>
<tr>
<td>Course: </td>
<td><?php echo "$course"; ?></td>
</tr>
<tr>
<td>Year Of Study: </td>
<td><?php echo "$yearOfStudy"; ?></td>
</tr>
<tr>
<td>Address: </td>
<td><?php echo "$address"; ?></td>
</tr>

</table>
</body>
</html>
40 changes: 40 additions & 0 deletions lab5a_q2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<html lang="en">
<head>
<meta charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lab 5a Q2</title>
</head>
<body>
<?php
$student = [
[
'name' => 'Alice',
'program' => 'BIP',
'age' => 21
],
[
'name' => 'Bob',
'program' => 'BIS',
'age' => 20
],
[
'name' => 'Raju',
'program' => 'BIT',
'age' => 22
],
];

echo "<table border='1' cellspacing='0' cellpadding='5'>";
echo "<tr><th>Name</th><th>Program</th><th>Age</th></tr>";

foreach($student as $member){
echo "<tr>";
echo "<td> {$member['name']}</td>";
echo "<td> {$member['program']}</td>";
echo "<td> {$member['age']}</td>";
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>
25 changes: 25 additions & 0 deletions lab5a_q3.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lab 5a Q3</title>
</head>
<body>
<?php
function multiplier($num,$num2){
return $num * $num2;
}
echo "<table border =1 cellspacing=0 cellpadding=5>";
echo "<tr><td>No</td><td>Multiplier</td><td>Answer</td>";
$num2 = 2;
for ($i=1; $i <=12 ; $i++) {
echo "<tr>";
echo "<td>$i</td>";
echo "<td>$num2</td>";
echo "<td>" .multiplier($i,$num2)."</td>";
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>

0 comments on commit 3a5c215

Please sign in to comment.