Page 1 of 1

Assign html + php into a variable

Posted: Tue Feb 23, 2010 3:23 am
by klevis miho
How can I assign html and php code into a variable?

For example this code:

<div id="errors">
<?php echo $alertmsg; ?>
</div>

Re: Assign html + php into a variable

Posted: Tue Feb 23, 2010 3:25 am
by pbs
Like this

Code: Select all

 
$html = '<div id="errors">'.$alertmsg.'</div>';
 

Re: Assign html + php into a variable

Posted: Tue Feb 23, 2010 3:27 am
by klevis miho
Thnx :)