title: PHP code showing blank page
body: <p>I want to send a email with input data from my html page. I am using next php script: </p>
  
  <pre><code>&lt;?php
  if((isset($_POST['budget']))&amp;&amp;(isset($_POST['type']))) {
      $email_to = "design.er@icloud.com";
      $email_subject = "Design";
  
      function died($error) {
          // your error code can go here
          echo "We are very sorry, but there were error(s) found with the form you submitted. ";
          echo "These errors appear below.&lt;br /&gt;&lt;br /&gt;";
          echo $error."&lt;br /&gt;&lt;br /&gt;";
          echo "Please go back and fix these errors.&lt;br /&gt;&lt;br /&gt;";
          die();
      }
  
  
      // validation expected data exists
      if(!isset($_POST['budget']) ||
          !isset($_POST['type'])) {
          died('We are sorry, but there appears to be a problem with the form you submitted.');       
      }
  
      $email = $_POST['email']; // required
      $budget = $_POST['budget']; // required
      $type = $_POST['type']; // required
      $comments = $_POST['comments']; // not required
      $error_message = "";
      $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
      $string_exp = "/^[A-Za-z .'-]+$/";
  
    if(strlen($error_message) &gt; 0) {
      died($error_message);
    }
  
      $email_message = "Form details below.\n\n";
  
      function clean_string($string) {
        $bad = array("content-type","bcc:","to:","cc:","href");
        return str_replace($bad,"",$string);
      }
  
      $email_message .= "Email: ".clean_string($email)."\n";
      $email_message .= "Budget: ".clean_string($budget)."\n";
      $email_message .= "Type: ".clean_string($type)."\n";
      $email_message .= "Comments: ".clean_string($comments)."\n";
  
  // create email headers
  $headers = 'From: '.$email."\r\n".
  'Reply-To: '.$email."\r\n" .
  'X-Mailer: PHP/' . phpversion();
  mail($email_to, $email_subject, $email_message, $headers);  
  ?&gt;
  
  &lt;!-- THERE MY PHP CODE, I REMOVED IT ESPECIALLY FOR STACKOVERFLOW, BUT IT EXIST --&gt;
  
  &lt;?php
  }
  ?&gt;
  </code></pre>
  
  <p>But it doesn't work. When I am clicking on submit - it shows me a blank page. 
  I can't understand what the problem is.</p>
  
  <p>Also, I tried next script and it worked perfectly:</p>
  
  <pre><code>  &lt;?php
       $to = "xyz@somedomain.com";
       $subject = "This is subject";
  
       $message = "&lt;b&gt;This is HTML message.&lt;/b&gt;";
       $message .= "&lt;h1&gt;This is headline.&lt;/h1&gt;";
  
       $header = "From:abc@somedomain.com \r\n";
       $header .= "Cc:afgh@somedomain.com \r\n";
       $header .= "MIME-Version: 1.0\r\n";
       $header .= "Content-type: text/html\r\n";
  
       $retval = mail ($to,$subject,$message,$header);
  
       if( $retval == true ) {
          echo "Message sent successfully...";
       }else {
          echo "Message could not be sent...";
       }
    ?&gt;
  </code></pre>