The objective of this assignment is to give you a chance to write some very simple web applications to familiarize yourself with the process of managing user input.
Any code that you return to the browser must be structured using valid HTML5. Although the presentation is not required, any presentation that you do choose to apply must be accomplished using valid CSS.
All pages should be published (and tested) in a subdirectory named assign3 within the public_html directory on your virtual production server on wcit and accessible via their own links in the Coursework list on your course home page. To facilitate grading, use the form Assign3 – Part n for each link label, where n corresponds to the number of the step below. Also, be sure to name all of your directories and files exactly as required (including capitalization).
1. (15 points) Write a simple Web application in a file named aggregates.php that will present the user with a form that requests eight numbers (using eight separate text input fields in a single form) and submits to the server using the GET method. Your application should ignore fields that are Ieft empty or set to 0 and not include them in its calculations. At this stage in the course, you may assume that the user will provide you with valid integer values, without validating them as such. However, your program should be able to handle both positive and negative values, and it should provide protection against HTML injection attacks. Upon submission of the form, your application should display a page listing the following facts about the numbers entered:
Their sum, Their count, Their average,
Their maximum, Their minimum, and
The count of positive even integers among them.
2. (10 points) Write a PHP file named tabte.php and published directly into your assign4 subdirectory that will generate and display the multiplication table for all values from 0 through 10 (yes, I know that the row and column for 0 will be all 0s!) You may find it helpful to Google a few examples of multiplication tables if you are a bit foggy on the concept.
Use a dynamically generated HTML table with header cells labeling each row and column and a caption element
that describes the table's purpose and the current range (high and low extents).
The values for the low and high ends of the range (use the same range for both the rows and the columns) must be provided using a query string in the URL of the link you place in the Coursework list on your homepage. In other words, it should be possible to generate a table with a different range of rows and columns simply by modifying the URL.
3. (10 points) Write another simple Web application in a file named futtname.php that will present the user with a form that requests their first and last names (using two separate text input fields) and submits to the server using the POST method. The output of your application should be a simple dynamically-generated web page that shows the user's full name (first name first). Both parts of the name should start with an initial uppercase letter and all the remaining letters in that part should be lowercase (even if the original input was not typed that way). Pay particular attention to protecting your application against HTML injection attacks!
This assignment has been answered 2 times in private sessions.
© 2023 Codify Tutor. All rights reserved