...

View Full Version : PHP "print" not generating output



chump2877
06-06-2005, 07:27 PM
Can anyone see why the following PHP code won't output to the browser:


print "<script type='text/javascript'>
<!--
function addTxt(what){
document.add_line.messagetext.value = document.add_line.messagetext.value + what;
document.add_line.messagetext.focus();
}
//-->
</script>";

print "<div style='border:1px inset #FFF;height:35px;width:300px;padding-top:4px;margin:auto'>

<a href='javascript:addTxt(' :)');'><img src='smileys/happy.gif' style='border:0;padding:2px;padding-left:0;margin:0;float:left;width:18px'></a>

<a href='javascript:addTxt(' :(');'><img src='smileys/sad.gif' style='border:0;padding:2px;margin:0;float:left;width:18px'></a>

<a href='javascript:addTxt(' ;)');'><img src='smileys/wink.gif' style='border:0;padding:2px;margin:0;float:left;width:18px'></a>

<a href='javascript:addTxt(' :D');'><img src='smileys/really_happy.gif' style='border:0;padding:2px;padding-right:0;margin:0;width:18px'></a>

</div>";

Thanks.

chump2877
06-06-2005, 07:50 PM
Nevermind, it outputs fine, but now the javascript won;t work inside the PHP print statement.....It has something to do with how I'm nesting my quote marks, because the javascript works just fine normally....hellllppp, this is probably an easy question for somebody....

chump2877
06-06-2005, 08:25 PM
Nevermind, I fixed it, ya slackers :rolleyes: lol

Fou-Lu
06-07-2005, 02:55 AM
Lol
For something like tihs you could use a herodic syntax to write it in, I often do that if I need to embed an xml into my script and don't want to worry too much about the quotations, and stepping out of php won't work due to short tags.
What is it that you ended up doing with it in case anyone else is suffering the same sort if situation?

mrruben5
06-07-2005, 12:18 PM
use ?>Your html tags<?php is what Fou-Lu means I think.

Fou-Lu
06-07-2005, 04:51 PM
no no, I mean herodic syntax, not php block levels:


print <<<JAVASCRIPT
<script type='text/javascript'>
<!--
function addTxt(what){
document.add_line.messagetext.value = document.add_line.messagetext.value + what;
document.add_line.messagetext.focus();
}
//-->
</script>
<div style='border:1px inset #FFF;height:35px;width:300px;padding-top:4px;margin:auto'>

<a href='javascript:addTxt(' :)');'><img src='smileys/happy.gif' style='border:0;padding:2px;padding-left:0;margin:0;float:left;width:18px'></a>

<a href='javascript:addTxt(' :(');'><img src='smileys/sad.gif' style='border:0;padding:2px;margin:0;float:left;width:18px'></a>

<a href='javascript:addTxt(' ;)');'><img src='smileys/wink.gif' style='border:0;padding:2px;margin:0;float:left;width:18px'></a>

<a href='javascript:addTxt(' :D');'><img src='smileys/really_happy.gif' style='border:0;padding:2px;padding-right:0;margin:0;width:18px'></a>

</div>
JAVASCRIPT;



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum