if ($composerlist[0] > 0) {
// Initialize previously used composer name and song
$oldcomposer = "old";
$oldsong = "old";
for ($i=0; $i<$composerlist[0]; $i++)
{
// Build a string composed of a 2-digit session number
// concatedated with the session title
if($sessionlist[$i+1] < 10) {
// prepend a 0 to the session number if it is single digit
$sessionString = "0" . $LESSON_MAP[$_SESSION[Product]][$sessionlist[$i+1]-1] .
" - " .
$LESSON_NAMES[$sessionlist[$i+1]];
} else {
// session number is 2 digit, so simply echo
$sessionString = $LESSON_MAP[$_SESSION[Product]][$sessionlist[$i+1]-1] .
" - " .
$LESSON_NAMES[$sessionlist[$i+1]];
} // endif sessionlist[i+1}...
// Build the row of output data
if ($i == 0) {
// if this is the first row of data output, start the table row
echo "
"; // begin a new table row
echo '
' . $composerlist[$i+1] . "
";
echo '
' . $songlist[$i+1] . "
";
echo '
' . $sessionString;
} else if (($composerlist[$i+1] != $oldcomposer) || ($songlist[$i+1] != $oldsong)) {
// Not the first row of data and either we have a new composer or a new song.
// Close off the previous row, and start a new row
echo "
"; // end the table data from the previous row
echo "
"; // end the previous table row
echo "
"; // begin a new table row
echo '
' . $composerlist[$i+1] . "
";
echo '
' . $songlist[$i+1] . "
";
echo '
' . $sessionString;
} else {
// New session for the same composer and song
// Insert a break to get a "new line" for the
// session # and title in the same TABLE row
echo " ";
echo $sessionString;
} // endif i == 0 else if, else
// update the old composer and old song
$oldcomposer = $composerlist[$i+1];
$oldsong = $songlist[$i+1];
} // endfor ...
// close of the last table row
echo "
"; // end the table data from the previous row
echo "
"; // end the previous table row
}
else
{
if ($_POST[Submit] == "Search") echo "
No matches found
";
} // endif else
?>
The search results show the sessions (lessons and/or games)
where the composer's musical compositions
appear in the selected Music Ace education software series product.