discourse-legacysite-perl/site/coaches/search.php

230 lines
11 KiB
PHP
Raw Normal View History

2024-06-17 12:42:14 +00:00
<?PHP include("config.php");
// set the page title
$pagetitle = "Search The Database";
// set meta tags
$meta_keywords = "search coaches";
$meta_description = "Do you want to search for coaches in our online triathlon coach database? Then use this form to enter your criteria.";
?>
<? include("include_common_head.php"); ?>
<?
//Array of states for use in the form
$state_list = mysql_query("SELECT * FROM ".$prefix."CoachesStates");
?>
<body class="listings">
<? include($common_path . "/ads/ad_wallpaper.html"); ?>
<div class="container">
<? include($common_path . "/templates/include_header.php"); ?>
<div class="main">
<div class="contentwrapper clearfix">
<? include("include_breadcrumb.php"); ?>
<section class="section listings section-has-widgets section-static remove-sidebar">
<div class="sidebar-b">
<? include("include_sidebar.php"); ?>
</div>
<div class="content content-has-widgets">
<div class="grid">
<div class="clearfix">
<h1>Search For A Coach</h1>
<p>If you would like to search for a coach, please use the form below. None of the fields are mandatory. Checking no box in a field indicates you don't care if a coach has or does not have certifications, a fit bike, or motion capture system. Checking regions selects all states in that region. Checking any state's box selects or deselects that state.</p>
<form enctype="multipart/form-data" action="search_X.php" method="post" name="searchform">
<p class="cont"><font color="red"><? echo $errmsg; ?></font></p>
<div class="dtable form">
<div class="drow">
<div class="dcell name">Name Search</div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="text" name="keyword" class="txt lngtext" />
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<h3>Info</h3>
</div>
</div>
<div class="drow">
<div class="dcell name">Certifications</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table width="100%" cellpadding="2" cellspacing="2">
<?
$results = mysql_query("SELECT * FROM gforum_CoachesCertifications ORDER BY coach_certification_id ASC");
$i = 0;
$grouping = 1;
echo("<tr>");
while ($row = mysql_fetch_array($results)) {
if(($grouping != $row[coach_certification_group]) OR !($i%3)) {
if (!($i%3)) echo ("<td width=\"33%\">&nbsp;</td>");
echo "</tr><tr>";
$grouping = $row[coach_certification_group];
$i = 0;
}
echo("<td width=\"33%\"><input type=\"checkbox\" name=\"certifications[]\" value=\"$row[coach_certification_id]\" >$row[coach_certification_name]</td>\n");
$i++;
}
while($i<3) {
echo("<td width=\"33%\">&nbsp;</td>");
$i++;
}
if(!($i%3)) echo "</tr><tr>";
echo("<td width=\"33%\"><input type=\"checkbox\" name=\"certifications[]\" value=\"999\" ><strong>ANY</strong></td>\n");
$i++;
while($i<3) {
echo("<td width=\"33%\">&nbsp;</td>");
$i++;
}
if(!($i%3)) echo "</tr><tr>";
echo("</tr>");
?>
</table>
</div>
</div>
<div class="drow">
<div class="dcell name">Services Offered</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table width="100%" cellpadding="2" cellspacing="2"><?
$results = mysql_query("SELECT * FROM gforum_CoachesServices ORDER BY coach_service_id ASC");
$i = 0;
echo("<tr>");
//echo("<input type=\"hidden\" name=\"services[]\" value=\"0\" >");
while ($row = mysql_fetch_array($results)) {
if(!($i%1)) echo "</tr><tr>";
echo("<td width=\"100%\"><input type=\"checkbox\" name=\"services[]\" value=\"$row[coach_service_id]\" >$row[coach_service_name]</td>\n");
$i++;
}
if(!($i%1)) echo "</tr><tr>";
echo("<td width=\"100%\"><input type=\"checkbox\" name=\"services[]\" value=\"999\" ><strong>ANY</strong></td>\n");
echo("</tr>");
?>
</table>
</div>
</div>
<div class="drow">
<div class="dcell name">Education</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table width="100%" cellpadding="2" cellspacing="2"><?
$results = mysql_query("SELECT * FROM gforum_CoachesDegrees ORDER BY coach_degree_id ASC");
$i = 0;
echo("<tr>");
//echo("<input type=\"hidden\" name=\"degree[]\" value=\"0\" >");
while ($row = mysql_fetch_array($results)) {
if(!($i%2)) echo "</tr><tr>";
echo("<td><input type=\"checkbox\" name=\"degree[]\" value=\"$row[coach_degree_id]\" >$row[coach_degree_name]</td>\n");
$i++;
}
if(!($i%2)) echo "</tr><tr>";
echo("<td><input type=\"checkbox\" name=\"degree[]\" value=\"999\" ><strong>ANY</strong></td>\n<td>&nbsp;</td>");
echo("</tr>");
?>
</table>
</div>
</div>
<div class="drow">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<h3>Location</h3>
</div>
</div>
<div class="drow">
<div class="dcell name">Region</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table width="100%" cellpadding="2" cellspacing="2">
<?
$regions = array();
$regionsql = "SELECT gts.statetag AS statetag, gtr.regionlong AS regionlong
FROM ".$prefix."CoachesStates AS gts
LEFT JOIN ".$prefix."CoachesRegions AS gtr
ON gts.regionid = gtr.regionid
ORDER BY gtr.regionid";
$region_list = mysql_query($regionsql);
//use loop for check box array
while($row = mysql_fetch_array($region_list)){
if (!is_array($regions[$row[regionlong]])) { $regions[$row[regionlong]] = array(); }
array_push($regions[$row[regionlong]], $row[statetag]);
}
$i = 0;
echo "<tr>";
foreach($regions AS $region => $statetag) {
if(!($i%4)) echo "</tr><tr>";
echo("<td><input type=\"checkbox\" name=\"region\" value=\"$region\" onClick=\"javascript: checkUncheck(this,'".implode("', '", $statetag)."');\">$region</td>\n");
$i++;
}
?>
</tr>
</table>
<p><em>*Selecting a region will select all states in that region. You can then deselect or select any additional states. Only the selected states will be included in your search. Leaving all boxes blank will select races in all states.</em></p>
</div>
</div>
<div class="drow">
<div class="dcell name">State</div>
<div class="dcell divider"></div>
<div class="dcell value">
<table width="100%" cellpadding="2" cellspacing="2">
<? //use loop for check box array
$i = 0;
echo "<tr>";
while($row = mysql_fetch_array($state_list)){
if(!($i%4)) echo "</tr><tr>";
echo "<td><input type='checkbox' id='states' name='states[]' value=\"$row[statetag]\"> $row[statelong]</td>\n";
$i++;
}
?>
</tr>
</table>
<p><em>*Leave blank to select all.</em></p>
</div>
</div>
<div class="drow actions">
<div class="dcell name"></div>
<div class="dcell divider"></div>
<div class="dcell value">
<input type="hidden" name="search_form" value="coach">
<input type="submit" value="Search" class="btn default">
</div>
</div>
</div>
</form>
</div><!-- end col-2/3 -->
</div><!-- end grid -->
</div><!-- end content -->
</section>
</div><!-- end contentwrapper -->
</div> <!-- end main -->
<? include($common_path . "/templates/include_footer.php") ?>
</div> <!-- container -->
</body>
<? include($common_path . "/templates/include_global_js.php") ?>
</html>