NogDog need your assistance if possible!
Ok I've got it to work if I use Javascript with span, but I was wondering if there is a way to edit this into php? As I don't really want to use JavaScript due to the obvious that not all people have it enabled! I've included the code for both below, do you have any ideas?
JavaScript:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!-- Hide from older browsers
function displayMenu(currentMenu) {
var thisMenu = document.getElementById(currentMenu).style
// If the menu is expanded, contract it
if (thisMenu.display == "block") {
thisMenu.display = "none"
}
else {
// If the menu is contracted, expand it
thisMenu.display = "block"
}
return false
}
// End hiding-->
</SCRIPT>
<STYLE TYPE="text/css">
<!--
.menu {display:none; margin-left:20px;}
-->
</STYLE>
And to create the link i've used:
<?php
//database connection here
$query="SELECT * FROM faq";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$cat=mysql_result($result,$i,"cat");
$question=mysql_result($result,$i,"question");
$answer=mysql_result($result,$i,"answer");
?>
<a href="" onclick="return displayMenu('<? echo $id; ?>')"><? echo $question; ?></a><br />
<span class="faq" id="<? echo $id; ?>"><? echo $answer; ?><br /><br /></span>
<?php
$i++;
}
?>
I have tried but just keep getting errors!
Many, many thanks in advance as always!
Linda