|
home—lects—exams—hws
D2L—breeze (snow day)
For this homework, you will submit four files (utils.php, utils-test.php, wow-constants.php, and skill-form.php) on D2L. In addition, I will visit the URL https://php.radford.edu/~yourUserName/itec325/hw03/skill-form.php to grade your work. If that URL is not accessible, you will get a 0 for that portion of the grading! (Be sure to get the name exactly right: a itec325 folder containing a hw03 folder.) Also, note that good test cases comprise nearly half of the points-possible, for problems that have you write a function.
(20pts) Write a function which takes in an array of strings (checkbox-descriptions) (and, a group-name), and returns a string that happens to be valid html for a series of checkboxes. The string should include newlines, and (if you want) each line might start with (say) 6 spaces, to serve as indentation.
For example, calling
Include at least two test cases;
you'll probably want to write a sample series of checkboxes by hand,
to serve as your expected-output.
Use label tags to group each checkbox with its adjacent text.
(10pts)
Include a function named (something like)
For example,
en | Hi |
de | 'Tag |
fr | 'Allo |
Include at least two test cases. (What if one of the strings contains, say, an ampersand character?) I suggest first writing the raw html for the table, and then cutting/pasting that html in as the expected-result; this will help you decide what whitespace etc. you want your function to produce.
Hint: I found my solution to actually be simpler by making a second helper function,twoStrsToHTML_tr , that only had two worry about creating a single row. Having test cases for the helper also let me have fewer/simpler tests for the main function.
For example,
given an array with
Finally, create a web-page
Note that this page is not actually a submittable form; it will just contain some checkboxes and an entry field; the submit button does nothing. (We'll get to that soon!)
You should also have one short, extra file wow-constants.php, which simply initializes two variables: one array with the 4 types of characters, and one array with the 6 character attributes (with their abbreviations as keys). (We'll add more to this file in future homeworks.)
Your skill-form.php will
Please run/check your program/html incrementally — don't write huge amounts of the assignment w/o even running it.
1I personally recommend using the Oxford comma, but will leave it to your preference. ↩
2the function to show-source a file is one of the few exceptions ↩
home—lects—exams—hws
D2L—breeze (snow day)
©2012, Ian Barland, Radford University Last modified 2013.Feb.14 (Thu) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |