//Directs user to comproj.html if the request object comproj is true. if(request.comproj) { redirect("comproj.html?companyname=" + escape(request.companyname)) } if(request.search1 || request.search2) { dbconnect(); //the code below checks which search the user is performing by checking for the request object //search1 and search2. This will determine which query to run. if(request.search1) { company = database.cursor("SELECT * FROM companies WHERE companyname LIKE '%" + request.search1 + "%'") } if(request.search2) { //Once we know that the search2 request object exists, we then check to see if the user clicked to //see all of the companies or just ones beginning with some letter that the user chose to do a //search on. if(request.search2 == "all") { company = database.cursor("SELECT * FROM companies ORDER by companyname") } else { var lowcaps = request.search2.toLowerCase() company = database.cursor("SELECT * FROM companies WHERE companyname LIKE '" + request.search2 + "%' OR companyname LIKE '" + lowcaps + "%' ORDER by companyname") } } }
if(request.newsearch) { write("") }
Company Information Search
case sensitive

Company Name contains: if(request.search1) { write("") } else { write("") }
Company Name begins with:
write("List All") write("A") write("B") write("C") write("D") write("E") write("F") write("G") write("H") write("I") write("J") write("K") write("L") write("M") write("N") write("O") write("P") write("Q") write("R") write("S") write("T") write("U") write("V") write("W") write("X") write("Y") write("Z")
/* The following loop dynamically outputs the names of companys that match the user's search criteria. Each company becomes a link that will send the company to the ".htm" page, which will produce a descriptive updateable form of the company. */ if(request.search1) { write("Company Names containing " + request.search1 + "
") } if(request.search2) { if(request.search2 == "all") { write("List of all companies
") } else { write("Company Names beginning with the letter " + request.search2 + "
") } } while(company.next()) { write("Bullet " + company.companyname + "
") }