I'm trying to store HTML in a database, so when I retrieve the form from the database, I need to show it as a form rather than text. Is there a way to do that?
This is the form
$form = "
";at the moment when I retrieve the above from the database it shows as text,
also the form field in the database is varchar(1000)
include('adodb.inc.php');
include('adodb-pager.inc.php');
$sql = 'select title as "TITLE",description as "DESCRIPTION",form as "ADD TO CART" from mathspapers order by sysdate desc';
$pager = new ADODB_Pager($db,$sql);
$pager->Render();
Thanks
解决方案
When you are storing text in Database you probably use addslashes().
Then when you return text from Database you need something like stripslashes() before you show your HTML text. PHP Manual on stripslashes