Posted by J.O. Aho on 03/06/06 06:22
a wrote:
> I've been storing some html data in a mysql database and creating webpages
> based on that code using a simple "echo $html" type command. I have some
> php code sprinked in and noticed that php doesn't execute this code, it just
> prints it. After reading some more about it, i found out you have to use
> eval() to execute a string of php code. My problem is that there is
> html/php code. is there a way to "execute" the html code along /w the php
> code, or somehow seperate it, so only php code gets the eval() function?
>
>
Yes you can, there is two ways
--- code 1 ---
<?PHP
$code="echo \"test\n\"; ?> <h1>hello</h1> <?PHP echo \"test2\n\"; ";
eval($code);
?>
--- eof ---
--- code 2---
<?PHP
$code="echo \"test\n\"; echo \"<h1>hello</h1>\"; echo \"test2\n\"; ";
eval($code);
?>
--- eof ---
//Aho
[Back to original message]
|