title: PHP code getting printed as it is
body: <p>I have just started learning PHP and was trying to create a responsive contact form using PHP. 
  But the problem is that my PHP code gets printed as it is on the web page as it is and not in the required format as I need it.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;title&gt;Contact Us&lt;/title&gt;
      &lt;link href="css/bootstrap.min.css" rel="stylesheet"&gt;
      &lt;link rel="stylesheet" type="text/css" href="styles.css"&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/start/jquery-ui.css"&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-
  ui.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;!-- &lt;img src="call.jpg" id="background"&gt; --&gt;
      &lt;div id="container-fluid"&gt;  
          &lt;div class="row"&gt;
              &lt;div class="col-sm-offset-1 col-sm-10 contactform"&gt;
                  &lt;h1&gt;Contact Us:&lt;/h1&gt;
                  &lt;?php
                      $name = $_REQUEST["name"];
                      $email = $_REQUEST["email"];
                      $message = $_REQUEST["message"];
                      $submit = $_REQUEST["submit"];
                      $to = "abc1996@xyz.com";
                      $var = rand(1,1000);
                      $subject = 'Complaint Registered. Complaint No.: '. echo "$var";
                      if($submit)
                      {
                          if(!$name)
                              $errors = $errors."&lt;p&gt;&lt;strong&gt;Name missing!&lt;/strong&gt;&lt;/p&gt;";
                          else
                              $name = filter_var($name,FILTER_SANITIZE_STRING);
                          if(!$email)
                              $errors = $errors."&lt;p&gt;&lt;strong&gt;Email missing!&lt;/strong&gt;&lt;/p&gt;";
                          else
                          {
                              $name = filter_var($email,FILTER_SANITIZE_STRING);
                              if(!filter_var($email,FILTER_VALIDATE_EMAIL))
                              {
                                  $errors = $errors."Please give a valid Email-Address!";
                              }
                          }
                          if(!$message)
                          {
                              $errors = $errors."&lt;p&gt;&lt;strong&gt;Message box can't be empty!&lt;/strong&gt;&lt;/p&gt;";
                          }
                          else
                          {
                              $message = filter_var($message,FILTER_SANITIZE_STRING);
                          }
                          if($errors)
                          {
                              $finalmsg = "&lt;div class='alert alert-danger'&gt; ".$errors "&lt;/div&gt;";
                          }
                          else
                          {
                              $date = date('d MM YY');
                              $content = "Hi $name. Thank you for your complaint. Your complaint has been registered on $date and your complaint number is: $var";
                              if(mail($to, $subject, $content))
                              {
                                  $finalmsg = '&lt;div class="alert alert-success"&gt;Your mail has been sent and we will REQUEST back to you asap&lt;/div&gt;';
                              }
                              else
                              {
                                  $finalmsg = '&lt;div class="alert alert-warning"&gt;Error Sending Mail. Try again later!&lt;/div&gt;';
                              }
                          }
                          echo $finalmsg;
                      }
                  ?&gt;
                  &lt;form action="" method="post"&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label for="name"&gt;Name &amp;#42: &lt;/label&gt;
                          &lt;input type="text" name="name" id="name" placeholder="Enter your Name " class="form-control"&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label for="email"&gt;Email &amp;#42:&lt;/label&gt;
                          &lt;input type="email" name="email" id="email" placeholder="Enter your Email " class="form-control"&gt;
                      &lt;/div&gt;
                      &lt;div class="form-group"&gt;
                          &lt;label for="message"&gt;Message &amp;#42:&lt;/label&gt;
                          &lt;textarea id="message" name="message" class="form-control" rows="5"&gt;&lt;/textarea&gt;
                      &lt;/div&gt;
                      &lt;input type="submit" name="submit" class="btn btn-success btn-lg" value="Send Message" id="submit"&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p> </p>
  
  <p>Also, it would be great if you help me in generating a random number and use it in my code. I have tried it in my code, please tell me whether it is correct or not.</p>
  
  <p>Thank You</p>