title: Adding simple math captcha
body: <p>I made captcha by this [tutorial][1], </p>
  
  <p>[1]: <a href="http://codechirps.com/how-to-add-a-completely-custom-captcha-to-any-web-form/" rel="nofollow">http://codechirps.com/how-to-add-a-completely-custom-captcha-to-any-web-form/</a> but it seems to me it doesn't complete. 
  I made code but i can send email even if i put wrong answer. I feel that i have to write extra code in php file but i don't know where. Any help greatly appriciated</p>
  
  <pre><code>&lt;div class="modal-body"&gt;
                  &lt;form class="contact" name="contact"&gt;
                      &lt;label class="label" for="name"&gt;Имя&lt;/label&gt;&lt;br&gt;
                      &lt;input type="text" name="name" class="input-xlarge"&gt;&lt;br&gt;
                      &lt;label class="label" for="email"&gt;E-mail&lt;/label&gt;&lt;br&gt;
                      &lt;input type="email" name="email" class="input-xlarge"&gt;&lt;br&gt;
                      &lt;label class="label" for="message"&gt;Сообщение&lt;/label&gt;&lt;br&gt;
                      &lt;textarea name="message" class="input-xlarge"&gt;&lt;/textarea&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
              &lt;div class="modal-footer"&gt;
                          &lt;p&gt;2 + 3 =&lt;/p&gt;
                          &lt;input type="text" name="captcha" /&gt;
                  &lt;input class="btn btn-warning" type="submit" value="Отправить" id="submit"&gt;
                  &lt;a href="#" class="btn btn-danger" data-dismiss="modal"&gt;Закрыть&lt;/a&gt;
  
  
  &lt;?php
  $myemail = '';
  if (isset($_POST['name'])) {
  $name = strip_tags($_POST['name']);
  $email = strip_tags($_POST['email']);
  $message = strip_tags($_POST['message']);
  $captcha = check_input($_POST['captcha']);
  echo "&lt;span class=\"alert alert-success\" &gt;Сообщение отправлено&lt;/span&gt;&lt;br&gt;&lt;br&gt;";
  
  if (!preg_match("/5/", $captcha))
  {
  show_error("Check your math, Dude");
  }
  
  
  $to = $myemail;
  $email_subject = "Contact form submission: $name";
  $email_body = "You have received a new message. ".
  " Here are the details:\n Name: $name \n ".
  "Email: $email\n Message \n $message";
  $headers = "From: $myemail\n";
  $headers .= "Reply-To: $email";
  mail($to,$email_subject,$email_body,$headers);
  }?&gt;
  </code></pre>