Lab Assignment 7 | Web Forms and Manipulating Strings Interactive Features Added In this assignment you will continue the design and implementation of your lab 5 (Age Calculator). You will add user-directed interactivity that allows the user to select a different month or year from a set a links you provide. Based upon the user request you should provide them with both horizontal and vertical age chart tables which are correctly laid out for the requested month and year, since users may predict their age in terms of days in the future or trace back to their age in a specific year/month. The day information will predefined as the first day of each requested month. Then the user can have the flexibility to select different days in the requested month as well. At the bottom of the script page, a table of hyperlinks which point to every single day of the requested month will be displayed for user to pick up day information. Design Requirements You will build upon the existing Age Calculator that you created in lab assignment 5. All the features of that assignment should remain in your current lab. You will simply be adding new features to the features you previously implemented. In the previous lab assignment you were to determine and display the current date, month (either based on a date being hard coded or the current date), or other months in the current year and other years. Rather than hard coding the alternate months and years, you should now allow the user to select these from a dynamic hyperlink list that you provide. An example of what this hyperlink may look like is provided in the URL and footer portion of the example diagram (see next page). Using the hyperlinks, you should pass variables to the.php file and then assign the values to the variables you had previously hard coded. You can retrieve the passed GET variables from the superglobal array. You should use logic to correctly display the age chart tables for the selected month and year. Your hyperlink variable values will need to be dynamically set by your code so they continue to work no matter what year is being displayed. When you allow the user to jump to later and previous months in a year and to other years, the currently displayed month and year can act as a starting point in determining what to show next and how to set up the dynamic hyperlink values. Note here the day information is predefined as the first day of each requested month. After the age chart tables have been displayed, you will display a line of text which shows the displayed day, month and year (see the red circle in the diagram). Then a set of hyperlinks which point to each individual day of the displayed month will be displayed for the user to pick a different day, instead of the predefined first day of each month. For this set of hyperlinks, in addition to month and year, the day information will be passed to the php script as a parameter as well. When the user initially accesses the web page you should display the current day, month and year (as they have not yet specified a particular month and year to view). No matter what month, day or year is being displayed, the ‘Today’ information on the top of the page should continue to display the current date. The ‘Today’ word should also always be a hyperlink that points back to the current date’s age calculator chart tables by hyperlinking to itself. Hint: You can set this hyperlink without passing any variable values as the script would then think that this is your first visit to the web page and thereby display the current day, month and year (as earlier noted/required). In contrast to your lab 5, you should remove the single link at the bottom of your current date’s page which you previously used to get to another date’s page. You should continue to stick to the basics, using functions already available in PHP. In addition to date() and mktime() functions, you can use another system defined function cal_days_in_month() which calculate the number of days for any given month and year. You should not need to use any other functions for this assignment. Constants should be used for values that do not change, and variables for values that change during the course of execution.
You should use a file name that will automatically load when a user specifies only the folder name in the URL. The file should be uploaded to your Lab Assignment 7 directory. Your XHTML file should be well- formed and created using a strict XHTML DTD. You can create the web page using any text editor (Microsoft Notepad, RogSoft Notepad+, Adobe Homesite, etc) that is not WYSIWYG capable (Adobe Dreamweaver, Microsoft Word, etc). You will continue to display your age charts inside XHTML tables that if printed to a printer, should look similar to what you see in your web browser. You should use XHTML for the layout of all and CSS for the formatting of each of the pages. Using an external.css file, add formatting of your choice to make the output more aesthetically pleasing.
Approach You can simply add a new one row table below the age chart tables to include a set of interactive links for user to select different month and year. The current selected day, month and year will be echoed out below this set of interactive links. After that, another table will include a set of interactive links for the user to select different days for the currently selected month and year. All interactive hyperlinks in the table will be generated by PHP script. You will want to determine, code, and validate the.php file itself using XHTML (and absent of any new CSS). Once working like the output given, you can begin adding the CSS formatting. Finally, validate all the pages and correct any ill-formed tags where necessary.