Boxes

100 points

Boxes

Requirements

Generated page is valid10
Form is available as specified10
Box is drawn correctly based on form submission50
Form is validated correctly with markings30
Total100 pts

Resources

Objective

Practice using forms and control structures

Instructions

Overview

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.

The 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

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.

Validation

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.