[Solved] displaying the html entities in php code


Use PHP pre defined $_SERVER variable :

$_SERVER[‘PHP_SELF’]

    <html>
    <body>

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <input type="text" name="keywords" id="keywordsid" value="sample keyword" />

    <input type="submit">
    </form>

    <?php
    if(isset( $_POST['keywords']))
     {
        echo $_POST['keywords'];
     }
    ?>
    </body>
    </html>

Here, <?php echo $_SERVER['PHP_SELF']; ?> helps you to get result on the same page without sending the request to another page.

solved displaying the html entities in php code