am trying to use a php function within my html code but it keeps treating this block as a comment!(colored green in the source and not outputting anything) though i used the same function in another file and it worked just fine even within html...
function x (){
$x = 'hello';
echo('<marquee direction="left" scrollamount="3" behavior="scroll" style="width:300px;
height: 15px; font-size: 11px;">');
echo $x;
echo'</marquee>';
}
<?php
echo x();
?>
The html file am using is a template i found online...any suggestions for what i should be checking?
Thanks!
Here's what will make that work:
<?php
function x (){
$x = 'hello';
echo('<marquee direction="left" scrollamount="3" behavior="scroll" style="width:300px;
height: 15px; font-size: 11px;">');
echo $x;
echo'</marquee>';
}
x(); // Not echo, because the function doesn't return a value.
?>
Here's a slightly nicer version:
<?php
function x ($message){
$html = '<marquee direction="left" scrollamount="3" behavior="scroll" style="width:300px; height: 15px; font-size: 11px;">'.$message.'</marquee>';
return $html;
}
echo x('hello');
?>