Hello all,
I have been thumping my head against the wall on this all evening, so if anyone can help me with this... the URL for the script as it is functioning is:
Http://www.ontarioeastern.com/test/viewroster.php.
What I have is a series of items. First is a Dropdown menu which selects a category pulled from the mySQL DB. Then it displays based on that category, the subcategories, with the road number range attributed to that subcategory. Each road number is a clickable link which will then display below the menu the actual information from the database for that specific record.
When you are selecting the sub category, the area below the menu is to display the description of the main category. That area then is filled with the individual record for the road number, when selected.
The problem is that I cannot get the information to pass through into the area below the menu. MySQL seems to be processing the last query of the three.. but displays nothing.
The source code is below. If anyone again has any suggestions, please let me know.
Many thanks for the help...
Phil
---- Source Code ----
<?
header ("Expires: Sun, 1 Jul 2001 05:00:00 GMT"); // Date in the past
header ("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); // Always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 Protocol
header ("Pragma: no-cache");
include("common.php");
$prevengine="";
$engcount=0;
$servicetype=trim("$servicetype");
$roadnumber=trim("$roadnumber");
?>
<HTML>
<HEAD>
<TITLE></TITLE>
<script language='javascript' src='functions_all.js'></script>
<STYLE TYPE="text/css">
<!--
BODY, P, TD { font-size: 10px;
font-family: Verdana, Geneva, Arial, sans-serif;
font-weight: bold;
}
a:link { font-size: 10px; font-family: Verdana, Geneva, Arial, sans-serif; font-weight: bold; text-decoration: none; color: #375522;}
a:hover { font-size: 10px; font-family: Verdana, Geneva, Arial, sans-serif; font-weight: bold; text-decoration: none; color: #FFFFFF;}
a:active { font-size: 10px; font-family: Verdana, Geneva, Arial, sans-serif; font-weight: bold; text-decoration: none; color: #375522;}
a:visited { font-size: 10px; font-family: Verdana, Geneva, Arial, sans-serif; font-weight: bold; text-decoration: none; color: #375522;}
#headline { font-size: 14px; text-align: left; text-transform: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; Color: #000000; Text-Indent: 0; }
-->
</STYLE>
<script language="JavaScript">
<!--
function jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</HEAD>
<body>
<table cellpadding=0 cellspacing=0 border=1 bordercolor=black width=600>
<tr>
<td height=20 bgcolor=c69709><table cellpadding=0 cellspacing=0 border=0 width=100% height=20>
<tr>
<td width=200 align=left> <font id=headline>Engine Roster</font></td>
<td width=400 align=right><select type="select-multiple" name="servicetype" onChange="jumpMenu('parent',this,0)" style=" font-size: xx-small;">
<?
if($servicetype!="") { ?><option value="<? echo $servicetype ?>" selected><? echo $servicetype ?></option>
<? } else { ?>
<option value="#" selected>Select Service Type</option>
<? } ?>
<option value="#">- - - - - - - - - - - - - -</option>
<?php
$dbquery = "select from servicetype order by categorytype";
$result = mysql_db_query($dbname,$dbquery); if(mysql_error()!=""){echo mysql_error();}
$catdescription = $row[description];
?>
<?php while($row = mysql_fetch_array($result))
{
?>
<option value="viewroster.php?servicetype=<?php echo urlencode($row[categorytype]) ?>"><?php echo $row[categorytype] ?></option>
<?php if($row = mysql_fetch_array($result))
{
?>
<option value="viewroster.php?servicetype=<?php echo urlencode($row[categorytype]) ?>"><?php echo $row[categorytype] ?></option>
<?php }
else
{
?> <? }
if($row = mysql_fetch_array($result))
{
?>
<option value="viewroster.php?servicetype=<?php echo urlencode($row[categorytype]) ?>"><?php echo $row[categorytype] ?></option>
<?php }
else
{
?> <? }
?>
<?php }
?></select>
</td></tr></table>
</td>
</tr>
<tr>
<td align=left bgcolor=375522>
<table border=0 cellpadding=1 cellspacing=2 align=left bgcolor=375522>
<?
$dbquery = "select from engineroster where servicetype = \"$servicetype\" order by enginetype, roadnumber";
$result = mysql_db_query($dbname,$dbquery); if(mysql_error()!=""){echo mysql_error();}
if(mysql_num_rows($result) > 0)
{
while($row=mysql_fetch_array($result)) {
if($prevengine!=$row[enginetype]) {
echo "<tr><td height=10 align=left bgcolor=000000><font color=ffffff>";
echo $row[enginetype];
$engcount=0;
echo "</font>";
} else {
}
echo "</td><td height=10 align=center bgcolor=C69709><a href='viewroster.php?servicetype=".urlencode($servicetype)."&roadnumber=".urlencode($row[roadnumber])."'>$row[roadnumber]</a></td>";
$prevengine = $row[enginetype];
$engcount = $engcount+1;
if(($engcount!=15) and ($engcount!=30) and ($engcount!=45) and ($engcount!=60) and ($engcount!=75))
{ }
else
{ echo "</tr><tr><td> </td>"; }
}
}
?></tr>
</table></td></tr>
<?
if($roadnumber!="")
{
$dbquery = "select * from engineroster where roadnumber = \"$roadnumber\" ";
$result = mysql_db_query($dbname,$dbquery); if(mysql_error()!=""){echo mysql_error();}
if(mysql_num_rows($result) > 0)
{
?>
<tr>
<td height=200 width=600 valign=top><? echo $row[enginetype] ?> - #<? echo $row[roadnumber] ?>
<hr width=90%>
<? echo $row[preroads] ?>
<br><? echo $row[notes] ?>
</td>
</tr>
<?
}
} else {
?>
<tr>
<td height=200 width=600 valign=top><? echo $catdescription ?></td>
</tr>
<? } ?>
</table>
</body>
</html>