PHP Programming (Online)
3 credits
Generated page is valid | 10 |
Form is available as specified | 10 |
Box is drawn correctly based on form submission | 50 |
Form is validated correctly with markings | 30 |
Total | 100 pts |
Practice using forms and control structures
For this lab you will need to create a single page PHP script that allows a user to submit a width and height that the page will then use to draw a box.
Your script can "draw" a box on the page by setting the width and height for a div whose border is shown. The box should only be shown when a valid width and height are available.
The form should allow the user to specify a width and a height for a box using textfields with labels. When the form is submitted it should be submitted back to the same page (self-submitting page) and that page should then process the width and height that were submitted.
If the form has not been submitted it should appear as normal. If a width and height have been submitted those values should be (re)displayed in the width and height fields. If a submitted width or height is blank, non-numeric, or less than or equal to zero, then the field containing the invalid value should have a red border and the field's label should appear as red.