CS 314 Lab 8. Creating a mysql search form
Due: 6/22 6 PM. 

Create a subdirectory named lab8 and do all of your work within that directory.

In this lab you will create 2-3 new pages for your CS 314 web site. The first (searchform.html) will contain a form that users can use to submit queries to your mysql database. The second (search.php) will contain the php code which performs the database query (using the form data) and generates an HTML result page. 

Resources:

see the PHP + mySql examples on the class examples page. 
C-level: 21 points.
Your form should contain a single lableled text box and a submit button. The user will enter a keyword into the textbox and hit submit. Use POST; the action of your form will be the php script that you create (see below).

Error checking: include a (client-side) javascript function to verify that the textbox is not empty. If the textbox is empty the form data should NOT be submitted. Instead: display an alert message and change the focus to the textbox. Note: you should be able to adapt code from assignment 6 to handle this.

Your Php script should formulate a query using the data posted from the search form. The query should request: 

book name 
author 
binding 
price 
for all the books that contain the keyword in the book name field. Display the results, sorted by book name, using an HTML table. Include column headings.

Note: it would be simplest to accomplish the sort by book name by including this as part of your query; however you could also sort the returned result-set within your php script.

B-Level 25 points.
Add a drop down menu containing: "Title", "Author", defaulting to "Title". Change the script to perform a search of the name or author fields as indicated by the drop-down menu selection. Sort the results accordingly. 

A-Level 30 points.
Modify the file search.php so that the result set contains hyperlink references of the form shown below. NOTE that the book's id will be URL-encoded into the link; the selected book's database id, bookid, will be accessible to the details.php script via the $_GET variable.

<A HREF="details.php?bookid=XXXX">How Green Was My Valley </a> 

The idea: when the user does a seach, they can click on any of the books in the result to obtain all of the information about the book (ISBN, binding, etc). see below 

You will need to create the details.php script to query the book database. Display all the data for the given book using an unordered list. 

Misc. 
your results page(s) should also contain: 

	page title 
	Descrptive heading (<H1>) 
	link back to the search form