Hi, I have created a simple newsletter form with a couple of text/img fields. All data is stored in a mysql db. I also created a preview function which just gets the right data based on the newsletter_id and uses a template. Now i need to create a view html source function. I have tried this but i doesn't work function getHTML(){ ob_start(); $newsletter_id = 3; include('preview.php'); $currentoutput = ob_get_clean(); return $currentoutput; } $content = getHTML(); echo $content; Code (markup): But directing the browser to preview.php?newsletter_id=3 shows the newsletter ok Any advice, tips
You will probable have to run a preg_replace on the $content ie: replace < with < and > with > and then echo the content like this <pre> <?php print_r ($content); ?> </pre> PHP: You may or may not need the <pre> tags, try it first ? EDIT: Try this: function pre($var) { $replace = array('<' => '<', '>' => '>'); return strtr($var, $replace); } echo pre($content); PHP: You will most likely also need to replace quotes " and & so just add to the array