title: How to utilize htmlspecialchars within echo
body: <p>You can visit this link for an example of my promlem :      <a href="http://jflaugher.mystudentsite.net/cmweb241/cmweb241_lab2.html" rel="nofollow">http://jflaugher.mystudentsite.net/cmweb241/cmweb241_lab2.html</a>                                                                                    </p>
  
  <p>Everything is working correctly, except that I am having problems utilizing the htmlspecialchars in my echo.  I am wanting the entity to show up in the echo and not the html character.  I have tried placing the htmlspecialchars within the echo, but then the paragraph tags shows up.  How do I utilize the htmlspecialchar in the echo, and display the echo in a paragraph tag?  I have been at this for some time and have gotten no where, as I am very new to PHP.</p>
  
  <p>For example, when I enter a '&amp;', I get that echoed back.  Instead of the '&amp;', I want the entity &amp;amp to be echoed.</p>
  
  <pre><code> &lt;?php
    $username = htmlspecialchars(str_replace(array("'", "\""), "", $_POST['username']));
    $password = htmlspecialchars(str_replace(array("'", "\""), "", $_POST['password']));
    $comment = htmlspecialchars(str_replace(array("'", "\""), "", $_POST['comment']));
  
    echo  "&lt;p&gt; Your Username is: $username .&lt;/p&gt; ";
    echo " &lt;p&gt;Your Password is: $password . &lt;/p&gt;";
    echo " &lt;p&gt;Your Comment was: $comment . &lt;/p&gt;";
  
   ?&gt;
  </code></pre>