title: Couldn't find constant error - PHP
body: <p>Hi can some one please point out my mistake here. I've got two PHP files. First view.php goes as follows; and the second as processor.php
  I see the if(constant('SELECTitem') == $i) line doesnt capture the desired input to be compared with $i hence straight goes to 'else' validation. Please correct me. Thanks.</p>
  
  <h2>view.php</h2>
  
  <pre><code>&lt;?php
  $con=mysql_connect('localhost','root') or die ("Server connection failure!");
  $db=mysql_select_db('regional_data',$con) or die ("Couldn't connect the database");
  $SQL="SELECT sbstart, sbend FROM newchk";
  $run=mysql_query($SQL,$con) or die ("SQL Error");
  $nor=mysql_num_rows($run);
  
  define("SELECTitem", form.options.value);
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;&lt;title&gt;&lt;/title&gt;
  &lt;script type="text/javascript"&gt;
  function ValidateData(form) 
  {
  var TextIn = document.getElementById('txtN');
  if(form.txtN.value == "")
  {
  alert("Text field is empty"); 
  return false;
  }else{
  alert ((form.options[form.options.selectedIndex].value) + (form.txtN.value));
  }
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form onsubmit="return ValidateData(this)" method="POST" action="processor.php"&gt;
  &lt;select STYLE='width:90px' name="options"&gt;&lt;?php
  while ($rec = mysql_fetch_array($run))
  {
      for($i=$rec['sbstart']; $i&lt;=$rec['sbend']; $i++)
      {
      echo "&lt;option id='options' value='$i'&gt;$i&lt;br&gt;&lt;/option&gt;";
      }
  }
  ?&gt;
  &lt;/select&gt;
  &lt;input type="text" id="txtN"&gt;
  &lt;input type="submit" name="subN" value="Save"&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <h2>processor.php</h2>
  
  <pre><code>&lt;?php
  $con=mysql_connect('localhost','root') or die ("Server connection failure!");
  $db=mysql_select_db('regional_data',$con) or die ("Couldn't connect the database");
  $SQL="SELECT * FROM newchk";
  $run=mysql_query($SQL,$con) or die ("SQL Error");
  $nor=mysql_num_rows($run);
  
  while ($rec = mysql_fetch_array($run))
  {
  for($i=$rec['sbstart']; $i&lt;=$rec['sbend']; $i++)
      {
      if(constant('SELECTitem') == $i)
       {
          if($rec['totsb'] &lt;= "0")
          {
          echo "You have already entred this cheque number."; 
          return false;
          } else {
          echo "You can proceed withi this entry"; 
          return false;
          }
       }
       else 
       { echo "Error: Cant find choosen in the databse"; 
        return false;
       }
      }
  }
  ?&gt;
  </code></pre>