title: PHP stops after return
body: <p>I have a PHP function that displays an error message as part of form validation, I have mixed in some HTML to create a page for it;</p>
  
  <pre><code>  function displayMessage($msg)
    {
        ?&gt;
        &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
        &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
        &lt;head&gt;          
          &lt;meta http-equiv="X-UA-Compatible" content="IE=EDGE"/&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=Windows-1252"/&gt;
          &lt;title&gt;Error sending message&lt;/title&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1" /&gt;
        &lt;/head&gt;
        &lt;body&gt;
        &lt;div style="box-sizing: border-box; width:100%;font-family:arial;font-size:16px;color:#333333;background:#ffe6e3;padding:10px;background:#ffe6e3;border:1px solid #fb8d8d;"&gt;
          &lt;?php return $msg;  ?&gt;
        &lt;/div&gt;
        &lt;/body&gt;
        &lt;/html&gt;
        &lt;?php
    }
  </code></pre>
  
  <p>When the code is run everything looks right in the browser, however, looking at the source code it stops right after the message is displayed so the closing div, body, and html tags are not shown.</p>
  
  <p>How do I get them to show, I have tried echo instead of return but that displays the error message but still processes the form. </p>