Back to DFS's Workshop Page
Back to Agenda Page
Back to the Project Page


Sorting Data from a File

For this problem, you are to cannibalize any available code and write a script which will do the following.

The PHP Script: sorttable.php

  1. Accept as data provided from outside the script an indicator of the sort desired by the user. Bulletproof the code to ensure that an illegal value has not been passed.
  2. Read the baseball player information from a file.
  3. Calculate the batting average (At Bats / Hits) for each player.
  4. Display the data in an HTML table.
  5. Sort the data as specified by the user. As the default, sort the data by last name.
  6. Display the sorted data in an HTML table. Allow the user to click on the column headings to select the desired sort.

To see how this could work, view the HTML source code of this possible analogous solution.


© 2006 DFStermole
Created 19 Nov 06
Last Modified 26 Nov 06