Print contents in new window
Posted on 2006-05-10
I'm trying to redesign a web-based DB search that I've got running on my server. As of now, the user enters some basic search criteria into an html form, these criteria are posted to a PHP script, and the script queries the DB and gets matching results. Each resulting record from the DB is dumped into an HTML table, and the results page is a series of tables, each populated with a record from the DB.
What I want to do is change the initial results page to be a list of links, each one corresponding to a match from the DB. If the user chooses the last name "Smith" to search, the results page would look something like:
Smith, Adam 10/12/1977
Smith, John 2/8/1980
Smith, Jonas 5/17/1966
What I was thinking was to create a class which is instantiated by each new result record from the DB. The constructor would return the html of the link, which could just be echoed to the intial search results page as unordered list elements from within the while loop that gets the DB results. When the link is clicked, the ideal action would be for another function in the class to be called, which would open a new window, dump the html-table-encoded results into it, and provide a "print me" link.
Does anyone have any suggestions on how I might pull this off?