Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
8b8cf83
footer and header
kashefinterior-tech Jan 23, 2026
bfc68ae
header.php added comments
kashefinterior-tech Jan 23, 2026
2ac945c
footer added comment
kashefinterior-tech Jan 23, 2026
f714275
index.php completed and added comments
kashefinterior-tech Jan 23, 2026
416c3e6
fixed index.php
kashefinterior-tech Jan 23, 2026
88e03ef
Create 04
kashefinterior-tech Jan 31, 2026
f098394
Merge pull request #1 from kashefinterior-tech/main
kashefinterior-tech Jan 31, 2026
30c4eed
deleted file 4
kashefinterior-tech Jan 31, 2026
3bc1115
week 4
kashefinterior-tech Jan 31, 2026
007b9f7
head.php
kashefinterior-tech Jan 31, 2026
3b7f27e
footer.php
kashefinterior-tech Jan 31, 2026
6eb5bfe
index.php
kashefinterior-tech Jan 31, 2026
3b19eb2
process.php
kashefinterior-tech Jan 31, 2026
be578bb
send_email.php
kashefinterior-tech Jan 31, 2026
49cd3ec
created lab 4 folder
kashefinterior-tech Jan 31, 2026
6ef17ec
css
kashefinterior-tech Jan 31, 2026
1cd89a3
src
kashefinterior-tech Jan 31, 2026
2121261
save
kashefinterior-tech Jan 31, 2026
cb586b0
commit
kashefinterior-tech Jan 31, 2026
f67f600
header
kashefinterior-tech Jan 31, 2026
28b5961
w
kashefinterior-tech Jan 31, 2026
e92be52
changed name to lab_04
kashefinterior-tech Jan 31, 2026
6cb25ef
header
kashefinterior-tech Jan 31, 2026
5d00e76
added link
kashefinterior-tech Feb 1, 2026
1f2d3c3
fixing the bug
kashefinterior-tech Feb 1, 2026
f2204ab
edith
kashefinterior-tech Feb 1, 2026
9287b86
includes
kashefinterior-tech Feb 1, 2026
2aa72bf
commit
kashefinterior-tech Feb 1, 2026
e3e54fc
commit
kashefinterior-tech Feb 1, 2026
e656f35
css
kashefinterior-tech Feb 1, 2026
b51abc2
css
kashefinterior-tech Feb 1, 2026
8649236
css
kashefinterior-tech Feb 1, 2026
bdf0851
commit
kashefinterior-tech Feb 1, 2026
11f7ef2
css commit
kashefinterior-tech Feb 1, 2026
9db913c
commit
kashefinterior-tech Feb 1, 2026
947d32e
Revert "commit"
kashefinterior-tech Feb 1, 2026
af95e0e
ds store
kashefinterior-tech Feb 1, 2026
15a2d1c
rewrite-copy of final lab-4.
kashefinterior-tech Feb 1, 2026
fbd9f14
remove
kashefinterior-tech Feb 1, 2026
2b4ba9e
project-1
kashefinterior-tech Feb 4, 2026
5a6ffe3
week-5
kashefinterior-tech Feb 4, 2026
c7589c4
week 5
kashefinterior-tech Feb 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Binary file added 03/.DS_Store
Binary file not shown.
19 changes: 9 additions & 10 deletions 03/02_fix_this_code/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@
ini_set('display_errors', 1);
error_reporting(E_ALL);


$host = "localhost"

$host = "localhost";
$dbname = "week_two";
$username = "root";
$password = "";

$dsn = "mysql:host=$hostdbname=$dbname";
// DSN (Data Source Name)
$dsn = "mysql:host=$host;dbname=$dbname";

try {

$pdo = new PDO($dsn $username,);
$pdo->setAttribute(PDO::ATTR_ERRMODE PDO::ERRMODE_SILENT);
$pdo = new PDO($dsn, $username, $password);

echo "Connected to database!";
// Set error mode
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

catch (PDOException $e {
echo "Database error: " . $e
echo "Connected to database!";
} catch (PDOException $e) {
echo "Database error: " . $e->getMessage();
}
9 changes: 9 additions & 0 deletions 03/03_make_it_maintainable/footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
// footer.php
// Shared footer HTML (reused across pages).
?>
<hr>
<p>&copy; 2026</p>
</body>
</html>

13 changes: 13 additions & 0 deletions 03/03_make_it_maintainable/header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
// header.php
// Shared page header HTML (reused across pages to avoid repetition).
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>My PHP Page</title>
</head>
<body>
<h1>Welcome</h1>
<hr>
48 changes: 22 additions & 26 deletions 03/03_make_it_maintainable/index.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
<?php
/* What's the Problem?
- PHP logic + HTML in one file
- Works, but not scalable
- Repetition will become a problem
// What I learned: Using arrays + loops + a single template page makes the site easier to maintain.
// I’ll apply this in Course Project Phase One instead of duplicating pages.

How can we refactor this code so it’s easier to maintain?
*/
require_once __DIR__ . '/header.php';

$items = ["Home", "About", "Contact"];
$pages = [
'home' => ['title' => 'Home', 'content' => 'Welcome to my PHP page.'],
'about' => ['title' => 'About', 'content' => 'This is the About section.'],
'contact' => ['title' => 'Contact', 'content' => 'This is the Contact section.'],
];

$current = $_GET['page'] ?? 'home';
if (!isset($pages[$current])) {
$current = 'home';
}
?>

<!DOCTYPE html>
<html>
<head>
<title>My PHP Page</title>
</head>
<body>
<nav>
<ul>
<?php foreach ($pages as $key => $page): ?>
<li><a href="index.php?page=<?= $key ?>"><?= $page['title'] ?></a></li>
<?php endforeach; ?>
</ul>
</nav>

<h1>Welcome</h1>
<h2><?= $pages[$current]['title'] ?></h2>
<p><?= $pages[$current]['content'] ?></p>

<ul>
<?php foreach ($items as $item): ?>
<li><?= $item ?></li>
<?php endforeach; ?>
</ul>

<footer>
<p>&copy; 2026</p>
</footer>

</body>
</html>
<?php require_once __DIR__ . '/footer.php'; ?>
Binary file modified assignments/.DS_Store
Binary file not shown.
Binary file modified assignments/labs/.DS_Store
Binary file not shown.
Binary file added lab_04/.DS_Store
Binary file not shown.
Binary file added lab_04/assets/bitumi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
127 changes: 127 additions & 0 deletions lab_04/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
* {
box-sizing: border-box;
}

body {
font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
background-color: #fff0f6;
color: #333;
line-height: 1.6;
}

header,
main,
footer {
max-width: 720px;
margin: 2rem auto;
padding: 1.5rem;
background-color: #ffffff;
border-radius: 16px;
border: 1px solid #ffd6e7;
}

h1 {
text-align: center;
margin-bottom: 1rem;
}

h1 img {
max-width: 220px;
height: auto;
display: block;
margin: 0 auto;
}

.nav {
text-align: center;
margin-bottom: 1rem;
}

.nav a {
text-decoration: none;
color: #d63384;
font-weight: 600;
margin: 0 10px;
}

.nav a:hover {
text-decoration: underline;
}

h2 {
text-align: center;
color: #d63384;
margin-bottom: 1.5rem;
}

fieldset {
border: 1px solid #ffc2da;
border-radius: 12px;
padding: 1.25rem;
margin-bottom: 1.5rem;
}

legend {
font-weight: bold;
color: #c2185b;
}

label {
display: block;
margin-top: 0.75rem;
font-weight: 500;
}

input,
textarea {
width: 100%;
padding: 0.6rem;
margin-top: 0.25rem;
border-radius: 8px;
border: 1px solid #ffc2da;
font-size: 1rem;
}

input:focus,
textarea:focus {
outline: none;
border-color: #d63384;
}

table {
width: 100%;
border-collapse: collapse;
margin-top: 1rem;
}

th,
td {
border: 1px solid #ffd6e7;
padding: 0.75rem;
}

th {
background-color: #fff0f6;
}

button {
background-color: #ff4fa3;
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 999px;
font-size: 1rem;
cursor: pointer;
}

button:hover {
opacity: 0.9;
}

footer {
text-align: center;
font-size: 0.9rem;
color: #777;
}


6 changes: 6 additions & 0 deletions lab_04/includes/footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<footer>
<p>Bake It Till You Make It</p>
<p>COMP1006 – Week 4</p>
</footer>
</body>
</html>
23 changes: 23 additions & 0 deletions lab_04/includes/header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bake It Till You Make It</title>
<link rel="stylesheet" href="css/main.css">
</head>

<body>
<header>
<h1 class="site-title">
<img src="assets/bitumi.png" alt="Bake It Till You Make It Bakery" class="logo">
</h1>


<nav class="nav">
<a href="index.php">Order</a>
<a href="#">Treats</a>
<a href="#">Help</a>
<a href="#">Contact</a>
</nav>
</header>
72 changes: 72 additions & 0 deletions lab_04/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php require "includes/header.php"; ?>

<main>
<h2>Place Your Order 🧁</h2>

<form action="process.php" method="post">

<fieldset>
<legend>Your Info</legend>

<label for="first_name">First name</label>
<input type="text" id="first_name" name="first_name" required>

<label for="last_name">Last name</label>
<input type="text" id="last_name" name="last_name" required>

<label for="email">Email</label>
<input type="email" id="email" name="email" required>
</fieldset>

<fieldset>
<legend>Pick Treats</legend>

<table border="1" cellpadding="8" cellspacing="0">
<tr>
<th>Treat</th>
<th>Quantity</th>
</tr>

<tr>
<td>Croissant 🥐</td>
<td>
<input type="number" name="items[croissant]" min="0" max="24" value="0">
</td>
</tr>

<tr>
<td>Muffin 🌙</td>
<td>
<input type="number" name="items[muffin]" min="0" max="24" value="0">
</td>
</tr>

<tr>
<td>Eclair 🤔</td>
<td>
<input type="number" name="items[eclair]" min="0" max="24" value="0">
</td>
</tr>
</table>
</fieldset>

<fieldset>
<legend>Notes (optional)</legend>

<label for="comments">Comments</label>
<textarea
id="comments"
name="comments"
rows="3"
placeholder="Allergies, delivery notes..."></textarea>
</fieldset>

<p>
<button type="submit">Submit Order</button>
</p>

</form>
</main>

<?php require "includes/footer.php"; ?>

Loading