diff --git a/05/includes/header.php b/05/includes/header.php index 2f9d821..3f17e30 100644 --- a/05/includes/header.php +++ b/05/includes/header.php @@ -2,10 +2,8 @@ - - - Week 4 - Form Validation - + + diff --git a/05/index.php b/05/index.php index de7347f..8ef0048 100644 --- a/05/index.php +++ b/05/index.php @@ -7,8 +7,8 @@
Customer Information - - +

- +

diff --git a/05/process.php b/05/process.php index ae6c6e9..df31b66 100644 --- a/05/process.php +++ b/05/process.php @@ -89,6 +89,42 @@ INSERT THE ORDER USING A PREPARED STATEMENT */ +$sql = "INSERT INTO orders (first_name, last_name, phone, address, email, chaos_croissant, midnight_muffin, existential_eclair, procrastination_cookie, finals_week_brownie, victory_cinnamonn_roll, comments) VALUES (:first_name, :last_name, :phone, :address, :email, :chaos_croissant, :midnight_muffin, :existential_eclair, :procastination_cookie, :finals_week_brownie, :victory_cinnamonn_roll, :comments)"; + +//prepare the query +$stmt = $pdo->prepare($sql); + +$chaosCroissant = $itemsOrdered['chaos_croissant'] ?? 0; +$midnightMuffin = $itemsOrdered['midnight_muffin'] ?? 0; +$existentialEclair = $itemsOrdered['existential_eclair'] ?? 0; +$procrastinationCookie = $itemsOrdered['procrastination_cookie'] ?? 0; +$finalsWeekBrownie = $itemsOrdered['finals_week_brownie'] ?? + +$stmt->bindParam(':first_name', $firstName); +$stmt->bindParam(':last_name', $lastName); +$stmt->bindParam(':phone', $phone); +$stmt->bindParam(':address', $address); +$stmt->bindParam(':email', $email); + + + + + + + + +//pull from $itemsOrdered amd store in variables + + + + + + + + + + + ?> diff --git a/car.php b/car.php new file mode 100644 index 0000000..4ae6aaf --- /dev/null +++ b/car.php @@ -0,0 +1,36 @@ +make = $make; + $this->model = $model; + $this->year = $year; + } + + //method + public function getCar(): string + { + return "Car: " . $this->year . " " . $this->make . " " . $this->model; + } + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..78e2b2b --- /dev/null +++ b/footer.php @@ -0,0 +1,8 @@ + +
+

COMP1006 - Week 2 Lab

+ + \ No newline at end of file diff --git a/header.php b/header.php new file mode 100644 index 0000000..16302db --- /dev/null +++ b/header.php @@ -0,0 +1,15 @@ + + + + + + COMP1006 - Lab 1 + + +

COMP1006 - Lab 1

+

Week 2: PHP OOP + Includes + PDO Connection

+
diff --git a/index.php b/index.php new file mode 100644 index 0000000..222dcf8 --- /dev/null +++ b/index.php @@ -0,0 +1,4 @@ + Follow the instructions outlined in instructions.txt to complete this lab. Good luck & have fun!😀

"; +require "footer.php"; \ No newline at end of file diff --git a/instructions.txt b/instructions.txt new file mode 100644 index 0000000..bea3373 --- /dev/null +++ b/instructions.txt @@ -0,0 +1,10 @@ +Lab One Instructions: + +1.) Clone or download the Lab One starter files from the course GitHub repository. +2.) Create a PHP file called car.php. In this file, create a class to represent a car. Properties should include make, model and year and include a method to return this information. Use include/require to include this code in index.php. Add comments to explain your code. (/5 marks) +3.) Instantiate a new instance of a car object and echo the car information in the browser (/2 marks) +4.) Using your local server (XAMPP, MAMP, WAMP), create a database. Create a file called connect.php and use PDO to connect to your database. Remember to include try/catch blocks to handle connection errors. Use include/require to include this code in index.php. Add comments to explain your code (/5 marks) +6.) Add a multi-line comment in index.php reflecting on which parts of the lab you found easy and which parts were challening. (/2 marks) +7.) Congrats! All done! Add me as a collaborator to your repository (username: JessicaGilfilan) and submit a github link to your completed lab on Blackboard. (/2 marks) + +/16 marks \ No newline at end of file diff --git a/lab 2.txt b/lab 2.txt new file mode 100644 index 0000000..d918c16 --- /dev/null +++ b/lab 2.txt @@ -0,0 +1,48 @@ +$template + + + <?= \$title ?> + + +HTML; + +$menu = << + +
  • + + +HTML; + +$footer = << +

    ©

    + + + +HTML; + +?> + + + +

    Welcome

    + + + + diff --git a/lab two.code-workspace b/lab two.code-workspace new file mode 100644 index 0000000..9a91aa7 --- /dev/null +++ b/lab two.code-workspace @@ -0,0 +1,8 @@ +{ + "folders": [ + { + "path": "../../../../../../../Downloads/COMP1006_Winter2026-main (real one)" + } + ], + "settings": {} +} \ No newline at end of file