Hi there,
I'm using a database to store my website's HTML codes.
and my table "CodeTable" consists of 3 fields (PageID, PageName, PageCode), and when I want to retrieve a page, I just select the PageName and echo the PageCode:
$Query = " SELECT PageCode FROM CodeTable WHERE PageName = '$HTTP_GET_VARS[PageName]' ";
$Result = mysql_query ($Query) or die ("Query Failed"
$PageDetails = mysql_fetch_array($Result);
echo "$PageDetails[PageCode]";
and when I want to call the desired page, just href="Pages.php?PageName=Page1"
(where Pages.php is the page that have the select statement.)
The problem is:
If the "PageCode" field has some PHP code embeded inside the HTML code (i.e. <html><? echo "Hi"; ?></html>), the PHP code will be treated as a TEXT! Although the code will be displayed in a page with PHP extension (Pages.php) but all the PHP code will be traeted as TEXT.
With HTML code, there is no problem.
Any idea how can I get the embeded PHP code get executed when I retrieve the "PageCode" from my table "CodeTable"?
I'm using a database to store my website's HTML codes.
and my table "CodeTable" consists of 3 fields (PageID, PageName, PageCode), and when I want to retrieve a page, I just select the PageName and echo the PageCode:
$Query = " SELECT PageCode FROM CodeTable WHERE PageName = '$HTTP_GET_VARS[PageName]' ";
$Result = mysql_query ($Query) or die ("Query Failed"
$PageDetails = mysql_fetch_array($Result);
echo "$PageDetails[PageCode]";
and when I want to call the desired page, just href="Pages.php?PageName=Page1"
(where Pages.php is the page that have the select statement.)
The problem is:
If the "PageCode" field has some PHP code embeded inside the HTML code (i.e. <html><? echo "Hi"; ?></html>), the PHP code will be treated as a TEXT! Although the code will be displayed in a page with PHP extension (Pages.php) but all the PHP code will be traeted as TEXT.
With HTML code, there is no problem.
Any idea how can I get the embeded PHP code get executed when I retrieve the "PageCode" from my table "CodeTable"?