title: How to check if a text area 'contains' a certain phrase with javascript / php?
body: <p>I'm trying to work out how to go about checking a text area to see if it contains a certain phrase. </p>
  
  <p>I believe I could maybe use .indexOf?</p>
  
  <p>It's just I have a validation script to check the contents of a contact form. Lately I have been receiving a fair bit of spam through. I have noticed that all these spam messages contain the phrase [url= and I thought, if I could perhaps add a small script to check if the text area contained such a phrase and, if so, stop the message being sent.</p>
  
  <p>At present I have this simple snippet of javascript to check whether the text area is blank:</p>
  
  <pre><code>if (message.val()=='') {  
          message.addClass('highlight');
          message.focus();
          return false;  
      } else message.removeClass('highlight');
  </code></pre>
  
  <p>Any good ways to add something to check if the message field contains [url=</p>
  
  <p>I also have a similar php validation script:</p>
  
  <pre><code>if (!$message) $errors[count($errors)] = 'Please click back and enter your message.';
  </code></pre>
  
  <p>Any ideas how I could add a similar validation script to check if message contains [url= in php too?</p>
  
  <p>Any help would be greatly appreciated! :o)</p>