title: How to display php code and html tags as text in a web page
body: <p>I have the following piece of code and wish to display it as text in a webpage. How can I do it? I wat the code mentioned below to be displayed as text in a webpage. The page might be either a .html page or a .php page. Kindly help.
       </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
   &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
   &lt;title&gt;Log in!&lt;/title&gt;
   &lt;style type="text/css"&gt;
    div {
       width:300px;
       height:120px;
       margin: 0px auto;
       margin-top: 100px;
        padding: 30px 20px;
        border:2px solid #00F;
       background-color:#0CF;
       border-radius:10px;
      }
  
   span{
      margin:0px auto;
       color:#F00;
        font-family:Verdana, Geneva, sans-serif;
       font-size:12px;
    }
  
   &lt;/style&gt;
   &lt;/head&gt;
  
  &lt;body&gt;
   &lt;/body&gt;
   &lt;?php
   require_once('conn.php');
  
  $sql="select * from contacts where contacts_id=14";
   $result=$mysqli-&gt;query($sql);
   $row=$result-&gt;fetch_array();
   if( isset($_POST['id']) &amp;&amp; $row['email']==$_POST['id'] &amp;&amp; $_POST['password']==$row['password'])
   {
       header("location:view.php")    ;
        $_SESSION['sid']= $row['email'];
      $flag=1;
   }
   ?&gt;
  
   &lt;div&gt;
   &lt;form method="post" action="&lt;?php echo $_SERVER['PHP_SELF'];?&gt;"&gt;
   &lt;table align="center" border="0"&gt;
     &lt;tr&gt;
        &lt;td&gt;Id&lt;/td&gt;
        &lt;td&gt;:&lt;/td&gt;
        &lt;td&gt;&lt;input type="text" name="id" placeholder="Email" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;Password&lt;/td&gt;
        &lt;td&gt;&amp;:&lt;/td&gt;
        &lt;td&gt;&lt;input type="password" name="password" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;/td&gt;
     &lt;td colspan="2"&gt;&lt;input type="submit" value="Log In!" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
   &lt;/table&gt;
    &lt;/form&gt;
       &lt;?php
        if (isset($_POST['id']) &amp;&amp; isset($_POST['password']) &amp;&amp; $flag==0)
       {
             echo "&lt;center&gt;&lt;span&gt;Invalid Id/Password&lt;/span&gt;&lt;/center&gt;";    
        }
  
     ?&gt;
      &lt;/div&gt;
     &lt;/body&gt;
     &lt;/html&gt;
  </code></pre>