|
Due: Mar.27 at start of class
Submit on D2L, and
have links to your form and form-handle-tests
available at https://php.radford.edu/~yourUserId/itec325/hw-sticky-ec/index.php.
(No hardcopy needed.)
This homework is worth 25pts of extra-credit.
Modify your form so that it is sticky:
on validation error,
you are given back the form,
except that any information from
A sticky-form submits to itself, conceptually. However, we still like having the form-printing and the success-handling be in separate files. So create a new top-level page, including the other files as appropriate. (Recall the skeleton given in the lecture notes.)
The one other change that this structure will require
is that your handle-sample tests will
need to change the name of what file they
For full credit, be sure to have your drop-downs, radio buttons, and check-boxes1 sticky, too. Since some of these were generated by a function, this means modifying those functions so that they are passed in an extra argument indicating what element(s) are to be pre-selected. This new argument should be an optional parameter, so it is backwards-compatible with your existing test-cases.
For the radio-button table, this means passing in an array indicating what
should be pre-selected for each row.
You may want to refer to the posted hw-solution, where table's radio-button
As usual, test-cases are a significant portion of the points-possible. Writing your test-cases first saves you time, honest!
For further extra credit:
Modify the form-printing so that
instead of hard-coded to use
In order to do this,
you are reluctantly allowed to use php's ability to break
<?php if (someCondition()) {> <p>This paragraph is actually inside the if-branch, even though we're not inside php-mode! This is odd, <?php echo $_POST['name']>, no? </p> <?php else { > <p>Hmmm. </p> <?php } > |
The proper solution, btw, is obvious but not supported by php: php should let me nest non-php-modes inside php-mode—that would exactly capture the program's real structure, while preserving php's cool feature of implicit-printing.) For a system that does this correctly, see racket's “scribble” syntax.
This page licensed CC-BY 4.0 Ian Barland Page last generated 2018.Mar.21 (Wed) | Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |