Jump to content

echo message


Bojak

Recommended Posts

<!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. 

post-165337-0-47970800-1399324813_thumb.png

Link to comment
https://forums.phpfreaks.com/topic/288263-echo-message/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.