title: Undefined index (CAPTCHA FORM)
body: <pre><code>Notice: Undefined index: captcha_code in /usr/www/users/bamboxevvz/recap2.php on line 51 The security code entered was incorrect.
  </code></pre>
  
  <p>Can someone help me?</p>
  
  <p>Basically I'm trying to add a captcha to the form, it is called "Securimage"</p>
  
  <p>Trying to implement it.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;?php
  error_reporting(E_ALL);
  ini_set('display_errors', 1);
  session_start();
  ?&gt;
  
  &lt;style&gt;
  #newheadform
  {
      position: relative;
      top: -15px;
      left: 700px;
      width: 280px;
      height: 361px;
      border: 1px solid #&lt;?php echo $Config['bodyFontColour']; ?&gt;;
      background-color: #&lt;?php echo $Config['bodyColour']; ?&gt;;
      color: #&lt;?php echo $Config['bodyFontColour']; ?&gt;;
      opacity: 0.85;
      padding: 10px;
      z-index: 100;
      font-family: sans-serif;
  }
  #newheadform input[type=text], #newheadform textarea
  {
      border: 1px solid #000;
      width: 96%;
  }
  &lt;/style&gt;
  
  &lt;?php
  include_once 'securimage/securimage.php';
  $securimage = new Securimage();
  ?&gt;
  
  
  &lt;!-- NEW ENQUIRY FORM START --&gt;
  
                  &lt;form method="post" action="&lt;?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?&gt;"&gt;
                  &lt;table id="newheadform" cellpadding="5" cellspacing="0"&gt;
          &lt;tr&gt;&lt;th colspan="2" align="center"&gt;&lt;font size="5"&gt;Email us now&lt;/font&gt;&lt;/th&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td&gt;Name*:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="name"/&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td&gt;Phone*:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="number"/&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td&gt;Email*:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="email"/&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td colspan="2"&gt;Message:&lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td colspan="2"&gt;&lt;textarea name="message" style="height: 50px;"&gt;&lt;/textarea&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td colspan="2" align="center"&gt;
                  &lt;img id="captcha" src="/securimage/securimage_show.php" alt="CAPTCHA Image" /&gt;
                  &lt;input type="text" name="captcha_code" size="10" maxlength="6" /&gt;
                  &lt;a href="#" onclick="document.getElementById('captcha').src = '/securimage/securimage_show.php?' + Math.random(); return false"&gt;[Different Image]&lt;/a&gt;
  
                 &lt;?php if($securimage-&gt;check($_POST['captcha_code']) == false) 
                             {
                  echo "The security code entered was incorrect.&lt;br /&gt;&lt;br /&gt;";
                  echo "Please go &lt;a href='javascript:history.go(-1)'&gt;back&lt;/a&gt; and try again.";
                 exit;
                 }
                 ?&gt;
                 &lt;?php if(isset($_POST['number']))
          {
              if(empty($_POST['name']) || empty($_POST['number']) || empty($_POST['email']))
                  echo '&lt;font color="red" size="1"&gt;&lt;b&gt;* These fields are compulsory&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;';
              else
              {
                  $headers='From: '.$_POST['email']."rn";
                  $headers.='Reply-To: '.$_POST['email']."rn";
                  $headers.='X-Mailer: PHP/'.phpversion();
                  $body='You received a contact request from '.$_POST['name'].' ('.$_POST['email'].') on your site '.$domainname."rn";
                  $body.='Contact number: '.$_POST['number']."rnrn";
                  if(!empty($_POST['message'])) $body.=$_POST['message'];
                  if(mail($_SESSION['contact3'],'New Enquiry from '.$domainname,$body,$headers))
                      echo '&lt;font color="green"&gt;&lt;b&gt;Your email has been sent&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;';
              }
          }
          else echo '&lt;font size="1"&gt;&lt;br&gt;* Compulsory&lt;/br&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;'; ?&gt;
          &lt;input type="button" name="send" value="Send"/&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  
  
  &lt;!-- NEW ENQUIRY FORM END --&gt;
  </code></pre>