<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
</script>
<script language="javascript">
function toggle() {
var element = document.getElementById("textMessage");
var text = document.getElementById("textSwitch");
if(element.style.display == "block") {
element.style.display = "none";
text.innerHTML = "show";
}
else {
element.style.display = "block";
text.innerHTML = "hide";
}
}
</script>
</script>
</head>
<body>
<?
$commentMessage = "this would be a test";
$x=1;
while ($row = mysql_query($commentMessage) > $x) {
echo '<a id="textSwitch" href="javascript:toggle();">show</a>';
echo '<div id="textMessage">' . $commentMessage . '<textarea></textarea></div>';
$x++;
}
?>
</body>
</html>
i want this to eventually connect to a database and loop through all the messages but for now i hard coded a message but it isnt working as i had hoped. its posting parts of the script instead of doing an echo. i attached a photo to explain more. if you could explain the issue i would be so thankful.