Assign html + php into a variable

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Assign html + php into a variable

Post 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>
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: Assign html + php into a variable

Post by pbs »

Like this

Code: Select all

 
$html = '<div id="errors">'.$alertmsg.'</div>';
 
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: Assign html + php into a variable

Post by klevis miho »

Thnx :)
Post Reply