I made this script for classes on my RPG site. The script is...
<?php
include "header.php";
membersonly();
echo "
<br><br><center>
<form name=options action=$PHP_SELF method=post>
<input type=hidden name=action value='2'>
<table width=90% align=center><tr><td valign=top width=35%>
<select name=buy onchange='switchText()'>
";
$t = mysql_query("SELECT * FROM classes ORDER BY classname");
$t2 = mysql_query("SELECT * FROM classes ORDER BY classname");
while ($classes=mysql_fetch_array($t)){
echo "<option value='$classes[classid]'>$classes[classname]</option>";
}
echo "
</select></td><td width=65%>
";
echo "
<p align=right><span id=desc></span><a name=d_link></a></p>
<script language='javascript'>
var desc = new Array();
";
while ($classes2 = mysql_fetch_array($t2)){
$lessons2 = mysql_query("SELECT * FROM classes_lessons WHERE classid='$classes2[classid]' ORDER BY lessonid") or die(mysql_error());
$all = "";
while ($lesson = mysql_fetch_array($lessons2)) {
$all .= "<a href=classroom.php?cid=$classes2[classid]&lid=$lesson[lessonid]>$lesson[title]</a>\\n";
}
echo "
desc[$classes2[classid]] = \"$all\";
";
}
echo "
function switchText() {
var element=document.getElementById(\"d_link\");
document.all(\"desc\").innerText = desc[document.all(\"buy\").options[document.all(\"buy\").selectedIndex].value];
element.href=\"0\";
element.innerText=\"\";
}
</script>
</td>
</tr>
</table>
<br><br>
";
include "footer.php";
?>
Everything works except that the html, instead of showing up as HTML, it shows up as plain text. How can I get it to appear as HTML and not text?
If you would like to see the script in action go to
http://www.dinstitute.com/classes_test.php
and click on History of Magical Foods and Divination