Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

ICT2613 Assignment 3 Due 3 August 2026 |Internet Programming|

Beoordeling
-
Verkocht
-
Pagina's
35
Cijfer
A+
Geüpload op
19-05-2026
Geschreven in
2025/2026

Comprehensive Study Material; Expert Verified & Exam-Ready This assignment package has been carefully developed to support serious academic preparation. Each solution is thoroughly researched, clearly explained, and backed by credible references giving you not just the answers, but a genuine understanding of the underlying concepts. The material is structured for clarity, making even complex topics approachable without sacrificing depth or accuracy. Whether you're consolidating your knowledge or preparing under time pressure, these resources are designed to help you walk into any exam with confidence.

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

UNIVERSITY OF SOUTH AFRICA
School of Computing


⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄⋄


ICT2613: Internet Programming

Assignment 3 — Year Module, 2026

⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄⋄




ICT2613
Module Code:
Internet Programming
Module Name:
Assignment 3
Assignment Number:
03 August 2026
Due Date:
135
Total Marks:




Submitted in partial fulfilment of the require-
ments for Internet Programming — UNISA 2026

, UNISA | ICT2613 Assignment 3 — Internet Programming



Task 1: Learner Extracurricular Registration Form

File: task1.php Chapter: 7 Marks: 25


1.1 What does Task 1 require?


Task 1 requires building a PHP web form that collects learner registration data for extracurric-
ular activities, validates that all required fields are completed, and then displays a formatted
registration summary with a calculated total cost.


1.2 What files are involved?


Two files are needed: task1.php (the form and processing logic) and task1.txt (the plain-
text version of the PHP code displayed in an iframe at the bottom of the page). The shared
navigation menu is included via menu.inc.


1.3 What is the complete PHP solution?


The solution below covers the full form structure (GET method), server-side validation, and
the formatted output paragraph with cost calculation.

1 <? php include ’ menu . inc ’; ? >
2 <! DOCTYPE html >
3 < html lang = " en " >
4 < head >
5 < meta charset = " UTF -8 " >
6 < title > Task 1 - Learner Registration </ title >
7 < style >
8 body { font - family : Arial , sans - serif ; margin : 30 px ; }
9 h1 { color : # 003366; }
10 label { display : block ; margin - top : 10 px ; font - weight : bold ; }
11 . error { color : red ; font - weight : bold ; }
12 . result { background : # eef6ff ; border - left : 4 px solid #003366;
13 padding : 14 px ; margin - top : 20 px ; border - radius : 4 px ; }
14 iframe { display : block ; margin : 30 px auto ; }
15 </ style >
16 </ head >
17 < body >


Page 2 of 35

, UNISA | ICT2613 Assignment 3 — Internet Programming



18 <h1 > Task 1: Extracurricular Activity Registration </ h1 >
19


20 <? php
21 // / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / Task 1 - Form Processing
// // // /// // // /// //
22


23 // Define activities : name = > cost (0 = free )
24 $activities = [
25 ’ Soccer ’ => 0,
26 ’ Netball ’ => 0,
27 ’ Choir ’ => 0,
28 ’ Chess ’ = > 150 ,
29 ’ Pottery ’ = > 200 ,
30 ’ Golf ’ = > 350 ,
31 ];
32


33 $error = ’ ’;
34 $success = false ;
35

36 // Only process when form is submitted
37 if ( isset ( $_GET [ ’ submitted ’ ]) ) {
38 $name = trim ( $_GET [ ’ learner_name ’] ?? ’ ’) ;
39 $grade = $_GET [ ’ grade ’] ?? ’ ’;
40 $chosen = $_GET [ ’ activities ’] ?? [];
41


42 // Validation
43 if ( empty ( $name ) ) {
44 $error = ’ Please enter the learner \ ’ s full name . ’;
45 } elseif ( empty ( $grade ) ) {
46 $error = ’ Please select a grade . ’;
47 } elseif ( count ( $chosen ) < 2) {
48 $error = ’ Please select at least two extracurricular activities . ’
;
49 } else {
50 $success = true ;
51 }
52


53 if ( $success ) {
54 // Calculate total cost


Page 3 of 35

, UNISA | ICT2613 Assignment 3 — Internet Programming



55 $total = 0;
56 foreach ( $chosen as $act ) {
57 if ( array_key_exists ( $act , $activities ) ) {
58 $total += $activities [ $act ];
59 }
60 }
61

62 // Display registration summary
63 echo ’ < div class =" result " > ’;
64 echo ’ <h2 > Registration Confirmation </ h2 > ’;
65 echo ’ <p > < strong > Learner Name : </ strong > ’ . htmlspecialchars (
$name ) . ’ </p > ’;
66 echo ’ <p > < strong > Grade : </ strong > ’ . htmlspecialchars ( $grade ) . ’
</p > ’;
67 echo ’ <p > < strong > Registered Activities : </ strong > </p > < ul > ’;
68 foreach ( $chosen as $act ) {
69 $cost = $activities [ $act ] > 0
70 ? ’R ’ . $activities [ $act ] . ’/ term ’
71 : ’ Free ’;
72 echo ’ <li > ’ . htmlspecialchars ( $act ) . ’ ( ’ . $cost . ’) </ li > ’;
73 }
74 echo ’ </ ul > ’;
75 echo ’ <p > < strong > Total Amount Payable per Term : </ strong > R ’ .
$total . ’ </p > ’;
76 echo ’ </ div > ’;
77 }
78

79 if ( $error ) {
80 echo ’ <p class =" error " > Form Incomplete : ’ . htmlspecialchars (
$error ) . ’ </p > ’;
81 }
82 }
83 ?>
84


85 <! - - Registration Form ( GET method ) -->
86 < form method = " get " action = " task1 . php " >
87 < input type = " hidden " name = " submitted " value = " 1 " >
88


89 < label for = " learner_name " > Full Name of Learner : </ label >


Page 4 of 35

, UNISA | ICT2613 Assignment 3 — Internet Programming



90 < input type = " text " id = " learner_name " name = " learner_name "
91 value = " <? php echo htmlspecialchars ( $_GET [ ’ learner_name ’] ??
’ ’) ; ? > "
92 size = " 40 " >
93


94 < label for = " grade " > Grade : </ label >
95 < select id = " grade " name = " grade " >
96 < option value = " " >-- Select Grade - - </ option >
97 <? php for ( $g = 1; $g <= 7; $g ++) : ? >
98 < option value = " Grade <? php echo $g ; ? > "
99 <? php echo (( $_GET [ ’ grade ’] ?? ’ ’) === " Grade $g " ) ? ’
selected ’ : ’ ’; ? > >
100 Grade <? php echo $g ; ? >
101 </ option >
102 <? php endfor ; ? >
103 </ select >
104


105 < label > Extracurricular Activities ( select at least 2) : </ label >
106 <? php foreach ( $activities as $name = > $cost ) : ? >
107 <? php
108 $label = $cost > 0 ? " $name ( R$cost / term ) " : " $name ( Free ) " ;
109 $checked = in_array ( $name , $_GET [ ’ activities ’] ?? []) ? ’
checked ’ : ’ ’;
110 ?>
111 < label style = " font - weight : normal ; " >
112 < input type = " checkbox " name = " activities [] "
113 value = " <? php echo $name ; ? > " <? php echo $checked ; ? > >
114 <? php echo $label ; ? >
115 </ label >
116 <? php endforeach ; ? >
117

118 <br >
119 < button type = " submit " > Register Learner </ button >
120 </ form >
121

122 <! - - Code display iframe ( required by assignment ) -->
123 < iframe src = " task1 . txt " height = " 400 " width = " 1200 " >
124 Your browser does not support iframes .
125 </ iframe >


Page 5 of 35

, UNISA | ICT2613 Assignment 3 — Internet Programming



126


127 </ body >
128 </ html >

Listing 1: task1.php — Extracurricular Registration Form



1.4 How does the validation logic work?


The form uses the HTTP GET method so all submitted values appear in the $_GET super-
global. Three conditions are checked before displaying results:


1. The learner_name field must not be empty after trimming whitespace.
2. The grade dropdown must have a selection other than the placeholder.
3. The activities checkbox array must contain at least two elements.


If any condition fails, an error message is shown. If all pass, the registration summary is
echoed using a loop that also accumulates the total payable amount.

Implementation Insight
Free vs Paid Activities: The $activities associative array stores each activity
name as a key and its per-term cost as the value. A cost of zero represents a free activ-
ity. This makes adding or removing activities straightforward because only the array
definition needs updating.



1.5 What does menu.inc contain?

1 < nav style = " background :#003366; padding :10 px ; text - align : center ; " >
2 <a href = " index . php " style = " color :# fff ; margin :0 12 px ; " > Home </ a > |
3 <a href = " task1 . php " style = " color :# fff ; margin :0 12 px ; " > Task 1 </ a > |
4 <a href = " task2 . php " style = " color :# fff ; margin :0 12 px ; " > Task 2 </ a > |
5 <a href = " task3 . php " style = " color :# fff ; margin :0 12 px ; " > Task 3 </ a > |
6 <a href = " task4 . php " style = " color :# fff ; margin :0 12 px ; " > Task 4 </ a >
7 </ nav >

Listing 2: menu.inc — Horizontal navigation menu




Page 6 of 35

Gekoppeld boek

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
19 mei 2026
Aantal pagina's
35
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$4.91
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
BeeNotes teachmetutor
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
313
Lid sinds
11 maanden
Aantal volgers
0
Documenten
861
Laatst verkocht
6 dagen geleden
BeeNotes

BeeNotes: Buzzing Brilliance for Your Studies Discover BeeNotes, where hard-working lecture notes fuel your academic success. Our clear, concise study materials simplify complex topics and help you ace exams. Join the hive and unlock your potential with BeeNotes today!

4.1

39 beoordelingen

5
23
4
4
3
8
2
1
1
3

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen