إعلانيمكن أن تكون علامتك التجارية هناعلامتك التجارية هنافي كل صفحة من Darslab · طلاب وأولياء أمور ومعلمونinfo@darslab.comاسأل عن الأسعارالأسعارinfo@darslab.com
☰ خطة العام · تكنولوجيا المعلومات والاتصالات (بالإنجليزية)

Term 1 review and your own mini-project

الأسبوع 15 · مراجعة الفصل الدراسي الأول (الوحدات ١–٣) ومشروع صغير من تصميمك · 3 دروس
3

Your own mini-project: plan, build, test, explain

ICT Secondary 2 Term 1, Review: pp. 7–113
GoalMake your own mini-project: plan, build, test and explain a reading-club page.
New words
mini-project · a small piece of work you design yourself from a plan to a testtest table · a table of inputs and the outputs you expect, filled in before you run anythingsite map · a drawing of the pages of a site and how they are linkedserver or browser · the place where a part runs: PHP on the server, HTML shown in the browser
Explanation

Now do the whole job once for an invented reading club; it needs only paper, and no device. Step 1, the plan: list the pages and the job of each, and draw them as a tree. Step 2, the design: two tables with keys, Members and Loans, one member to many loans, and write two or three sample records with invented nicknames, and no real names or numbers. Step 3, the form for adding a member, with the names of its controls. Step 4, a short valid PHP snippet that uses a variable, an if with elseif and else, and a switch. Step 5, a test table: inputs and the outputs you expect. Step 6, one sentence: the PHP runs on the server, and the browser only receives and shows the HTML that comes out.

joinmember.phplistbooks.phploans.phphelp.phpindex.php
Worked examples
loan_idmember_idbook
11Sea Stories
21Star Maps
32Sea Stories
The two tables with invented data. Each loan holds the number of one member. The foreign key column is highlighted.
Html
1<form method="post" action="join_member.php">
2    <input type="text" name="nick">
3    <input type="submit" name="join_btn" value="Join">
4</form>
The form for adding a member. The names of the controls are nick and join_btn, and the method is post.
Php
1<?php
2$day = 6;
3$books = 5;
4if ($books >= 3) {
5    $level = "silver";
6} else {
7    $level = "new";
8}
9switch ($day) {
10    case 5: echo "Meeting"; break;
11    case 6: echo "Book swap"; break;
12    default: echo "Closed";
13}
14echo " - ", $level;
15?>
Output
Book swap - silver
A short valid PHP snippet for the project. It uses variables, an if with else, and a switch with break. With day 6 and 5 books the page prints Book swap, a dash and silver.
daybooksexpected output
65Book swap - silver
51Meeting - new
23Closed - silver
The test table: first write what you expect, then compare it with what the page prints. The first row is checked against the snippet above.
Class activity

Do all six steps on a sheet of paper for a club of your own invention (a chess club, a garden club...). Check at the end that your PHP lines end with semicolons, that each switch case ends with break, that no real person appears in the sample records, and that your test table has at least three rows.

Practice
1
Why is a test table filled in before running the code?
2
In the project, which column of Loans is the foreign key?
3
What does the snippet print for day 5 and 1 book?
4
Which part of the project runs on the server and which in the browser?