title: Protecting against html injection
body: <p>So I know that you can do <code>$words = htmlspecialchars($_POST['name']);</code>
  in php to escape the special characters and prevent some html injection.</p>
  
  <p>But I'm having trouble actually implementing it into my php code. I was reading that you have to use it before you display whatever it is you're displaying to the viewer of the site but I'm lost as to how to do this. I am a bit of a beginner with php.</p>
  
  <p>So i was able to do the sql injection part but here's the part of the code where I am stuck at, as I described above. </p>
  
  <p>I am trying to prevent html injection for title blog and tag</p>
  
  <pre><code>$result= mysql_query("SELECT * FROM Bpost");
  
  echo '&lt;div class = "blog" align = "center"&gt;';
      while($row = mysql_fetch_array($result))
          {
  
          echo "&lt;div class = 'tname'&gt;";
          echo $row['title']; 
          echo '&lt;/div&gt;';
  
          echo '&lt;div class = "bpost"&gt;';
          echo $row['blog'];
          echo '&lt;/div&gt;';
  
          echo '&lt;div class = "tag"&gt;';
          echo $row['tags'];
          echo '&lt;/div&gt;';
          echo '&lt;/br&gt;';
  
          }
  echo '&lt;/div&gt;';
  </code></pre>
  
  <p>If you need sample code from my other stuff let me know. To me this seem like this was enough.</p>