title: PHP contact form isn't working when first installed
body: <p>I just installed a new PHP contact form but it isn't working. I already tried to fix it but I can't figure out how to fix it. Can somebody take a look at it and give me a fix? 
  The PHP code: </p>
  
  <pre><code>      $to = 'email@hotmail.com';
        $subject = 'Contact';
        $contact_submitted = 'Your message has been sent.';
  
  
        function email_is_valid($email) {
          return preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i',$email);
        }
        if (!email_is_valid($to)) {
          echo '&lt;p style="color: red;"&gt;You must set-up a valid (to) email address before this contact page will work.&lt;/p&gt;';
        }
        if (isset($_POST['contact_submitted'])) {
          $return = "\r";
          $youremail = trim(htmlspecialchars($_POST['your_email']));
          $yourname = stripslashes(strip_tags($_POST['your_name']));
          $yourmessage = stripslashes(strip_tags($_POST['your_message']));
          $contact_name = "Name: ".$yourname;
          $message_text = "Message: ".$yourmessage;
          $user_answer = trim(htmlspecialchars($_POST['user_answer']));
          $answer = trim(htmlspecialchars($_POST['answer']));
          $message = $contact_name . $return . $message_text;
          $headers = "From: ".$youremail;
          if (email_is_valid($youremail) &amp;&amp; !eregi("\r",$youremail) &amp;&amp; !eregi("\n",$youremail) &amp;&amp; $yourname != "" &amp;&amp; $yourmessage != "" &amp;&amp; substr(md5($user_answer),5,10) === $answer) {
            mail($to,$subject,$message,$headers);
            $yourname = '';
            $youremail = '';
            $yourmessage = '';
            echo '&lt;p style="color: blue;"&gt;'.$contact_submitted.'&lt;/p&gt;';
          }
          else echo '&lt;p style="color: red;"&gt;Please enter your name, a valid email address, your message and the answer to the simple maths question before sending your message.&lt;/p&gt;';
        }
        $number_1 = rand(1, 9);
        $number_2 = rand(1, 9);
        $answer = substr(md5($number_1+$number_2),5,10);
      ?&gt;
      &lt;form id="contact" action="contact.php" method="post"&gt;
        &lt;div class="form_settings"&gt;
          &lt;p&gt;&lt;span&gt;Name&lt;/span&gt;&lt;input class="contact" type="text" name="your_name" value="&lt;?php echo $yourname; ?&gt;" /&gt;&lt;/p&gt;
          &lt;p&gt;&lt;span&gt;Email Address&lt;/span&gt;&lt;input class="contact" type="text" name="your_email" value="&lt;?php echo $youremail; ?&gt;" /&gt;&lt;/p&gt;
          &lt;p&gt;&lt;span&gt;Message&lt;/span&gt;&lt;textarea class="contact textarea" rows="5" cols="50" name="your_message"&gt;&lt;?php echo $yourmessage; ?&gt;&lt;/textarea&gt;&lt;/p&gt;
          &lt;p style="line-height: 1.7em;"&gt;To help prevent spam, please enter the answer to this question:&lt;/p&gt;
          &lt;p&gt;&lt;span&gt;&lt;?php echo $number_1; ?&gt; + &lt;?php echo $number_2; ?&gt; = ?&lt;/span&gt;&lt;input type="text" name="user_answer" /&gt;&lt;input type="hidden" name="answer" value="&lt;?php echo $answer; ?&gt;" /&gt;&lt;/p&gt;
          &lt;p style="padding-top: 15px"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;input class="submit" type="submit" name="contact_submitted" value="send" /&gt;&lt;/p&gt;
        &lt;/div&gt;
      &lt;/form&gt;`
  </code></pre>
  
  <p>Can somebody help me? The error I get: <a href="http://i50.tinypic.com/2hfpe7m.jpg" rel="nofollow">http://i50.tinypic.com/2hfpe7m.jpg</a>.</p>