NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page [resolved] Executing HTML-PHP code from variables

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 05-23-2007, 07:58 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
mignolo's Avatar
Join Date: Mar 2007
Posts: 461
mignolo is a jewel in the roughmignolo is a jewel in the roughmignolo is a jewel in the rough
 



Help! Executing HTML-PHP code from variables


The problem is:
I have html-php codes stored in mysql as strings... I query mysql and i obtain some variables like these:

$str_phpcode1 = "<div><?php echo "Hello world"; ?></div>";
$str_phpcode2 = "<span><?php func_loan(); ?></span>";
...

Obviously if I write
echo $str_phpcode1; or echo $str_phpcode2;
the strings will be printed as text and the "echo" and "func_loan()" are not executed as php code.

Is there a solution?
Thank you

Resolved:

eval("?>".$str_phpcode1."<?php ");
mignolo is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 09:44 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger