Internet Programming
ICT2613
Semester 1
Assignment 3 php only answers
,Task 1, page name: task1.php, chapter: 2, marks: 15
Generate the following statement by adhering to the instructions given below:
I am registered for ICT2613 in 2020. ICT2613 has 3 assignments.
• Create three variables to store the values displayed in bold. Use camel case
variable names.
• The output should be generated (including bold) using an echo statement. No
need to
display the output in Courier New font.
• Note that the values linking the bold words with one another (for example "I am
registered
for") are not part of the variable declarations.
Task 2, page name: task2.php, chapters: 2 & 7, marks: 20
Create a form to facilitate registration of participants for a hackathon. The form
should contain
the following:
• Two text fields to input the name and the e-mail address of the participants
• Three checkboxes with options Project Leader, Programmer and Tester. A
participant
should choose at least one but they can choose all three roles as well.
• A drop-down list to input one of these dietary requirements: None, Vegetarian,
Vegan,
Halaal and Banting. A participant can only choose one of these options.
• A submit button
Task 3, page name: task3.php, chapters: 3 & 4, marks: 15
Create a database with one table modules. Create the following columns for the
modules
table:
code, which is the primary key for storing unique 7-character module codes
name, which stores the names of the modules
lecturer, which stores the primary lecturers of the modules
Task 4, page name: task4.php, chapters: 3, 4 & 7 marks: 25
Connect to the database created in task 3.
Present the data in the modules database table in a HTML table format on the web
page.
Provide three different forms on the task page to add, to update and to delete from
the
modules database table. Details of the forms are given below:
, TASK 1 :
<?php
// assign variables
$courseCode = 'ICT2613';
$currentYear = '2020';
$numAssignments = 3;
echo 'I am registered for <b>' . $courseCode . '</b> in <b>' . $currentYear .
'</b>. <b> ' .
$courseCode . '</b> has <b>' . $numAssignments . '</b> assignments.';
?>
TASK 2 :
<?php
// assign variables
$firstLoad = filter_input(INPUT_POST, 'firstload');
if (!isset($firstLoad)) {$firstLoad = TRUE;}
$isValid = TRUE;
$isValidEmail = TRUE;
//get values from POST array
$name = filter_input(INPUT_POST, 'name');
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
$role = filter_input(INPUT_POST, 'role', FILTER_SANITIZE_SPECIAL_CHARS,
FILTER_REQUIRE_ARRAY);
$foodtype = filter_input(INPUT_POST, 'foodtype');
//check if all values are filled and/or valid except on first load of page
$allValid = FALSE;
if ($firstLoad !== TRUE) {