PHP code to use the markdown parser
Question
I am attempting to use MarkItUp and PHP Markdown Parser. But I am don't know how to invoke the parser in the preview.php file.
My preview.php is invoked and correct form data is sent by inspect the network call. But instead of parsed text only the content of the file is listed in the preview window.
Following is the content of my preview.php
include_once "markdown.php";
$html=Markdown($_POST['data']);
echo htmlentities($html);
markdown.php is placed at the same level as preview.php.
Also I verified that my Apache does support php. http://localhost/test.php
renders properly where test.php is simply <?php phpinfo(); ?>
What's wrong with my preview.php?
Solution
If that's exactly the content of preview.php, you're missing a <?php
at the beginning.
OTHER TIPS
You're probably just missing an opening <?php
before your PHP code...‽