Sorry for the delay in posting the code in question (minus my experiments). Here's the code, broken into two more posts:
<head>
<script type="text/javascript" language="JavaScript">
//<!--
function submitForm(){
document.transfer_art.submit();
}
function toggleLayer(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"block";
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
style2.display = style2.display? "":"block";
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
style2.display = style2.display? "none":"block";
}
}
function searchHelp(theURL) {
newwindow = window.open(theURL, '', 'height=400, width=300, toolbar=no, scrollbars=yes, menubar=no, statusbar=no');
if (window.focus) {newwindow.focus()}
}
//-->
</script>
</head>
<body>
<?php
//Call up onnection info for DB.
require ('scripts/db.php');
//Replace old codes.
function convertCodes($input) {
$search = array("L1", "2", "3", "4", "5", "RIP", "RIC", "RAC", "1");
$replace = array("AL", "SS", "SCI", "MTH,SCI", "MTH", "IP", "IC", "AC", "AL");
$return = str_replace($search, $replace, $input);
return $return;
}
//Enable searching of old codes as well as new ones.
function convertCodesReverse($input) {
$search = array("1", "2", "3", "4", "5", "RIP", "RIC", "RAC", "1", "2", "3", "4", "5", "RIP", "RIC", "RAC");
$replace = array("AL", "SS", "SCI", "MTH,SCI", "MTH", "IP", "IC", "AC", "al", "ss", "sci", "mth,sci", "mth", "ip", "ic", "ac");
$return = str_replace($replace, $search, $input);
return $return;
}
//The following SQL statements are used to populate the drop-down lists for
//State, City and School.
$sql_state = "SELECT DISTINCT state FROM transfer_articulation ORDER BY state";
$sql_city = "SELECT DISTINCT city FROM transfer_articulation WHERE state = '" . strip_tags(stripslashes($_GET['state'])) . "' ORDER BY city";
$sql_school = "SELECT DISTINCT sbgi_desc FROM transfer_articulation WHERE state = '" . strip_tags(stripslashes($_GET['state'])) . "' ORDER BY sbgi_desc";
//This list of IF statements makes the Advanced search possible. A search criteria
//will be included if and only if the user inputs into its corresponding
//input box, otherwise it is left empty and doesn't affect the SQL statement.
if(!empty($_GET['subject'])){
$subject = "AND (SUBJ_UNIV LIKE '%" . strip_tags(stripslashes($_GET['subject'])) . "%' OR SUBJ_TRANS LIKE '%" . strip_tags($_GET['subject']) . "%') ";
}
if(!empty($_GET['course'])){
$course = "AND (NUMB_UNIV LIKE '%" . strip_tags(stripslashes($_GET['course'])) . "%' OR NUMB_TRANS LIKE '%" . $_GET['course'] . "%') ";
}
if(!empty($_GET['title'])){
$title = "AND (TITLE_UNIV LIKE '%" . strip_tags(stripslashes($_GET['title'])) . "%' OR TITLE_TRANS LIKE '%" . $_GET['title'] . "%') ";
}
if(!empty($_GET['attributes'])){
$attributes = "AND ATTRIBUTES LIKE '%" . convertCodesReverse(strip_tags(stripslashes($_GET['attributes']))) . "%' ";
}
if(!empty($_GET['term'])){
$term = "AND TERM_ACCEPT LIKE '%" . strip_tags(stripslashes($_GET['term'])) . "%' ";
}
if(!empty($_GET['state'])){
$_SESSION['state_name'] = $_GET['state'];
$state = "STATE LIKE '" . strip_tags(stripslashes($_GET['state'])) . "' ";
}
if(!empty($_GET['city'])){
$city = "AND CITY LIKE '" . strip_tags(stripslashes($_GET['city'])) . "' ";
}
if(!empty($_GET['school'])){
$_SESSION['school_name'] = $_GET['school'];
$school = "AND SBGI_DESC LIKE '" . str_replace("'", "''", strip_tags(stripslashes($_GET['school']))) . "' ";
}
$_SESSION['subject'] = $subject;
$_SESSION['course'] = $course;
$_SESSION['title'] = $title;
$_SESSION['attributes'] = $attributes;
$_SESSION['term'] = $term;
$_SESSION['state'] = $state;
$_SESSION['city'] = $city;
$_SESSION['school'] = $school;
$_SESSION['school_name'] = $_GET['school'];
$_SESSION['historic'] = $_GET['historic'];
//The mssql_query built-in function is used here to pass the SQL to the
//database and return the result set as an array.
$rs_state = mssql_query($sql_state, $conn);
$rs_city = mssql_query($sql_city, $conn);
$rs_school = mssql_query($sql_school, $conn);
?>
(Lotsa code, so one more post to go)