Filter some words

Posted by bob on Stack Overflow See other posts from Stack Overflow or by bob
Published on 2010-03-12T06:25:20Z Indexed on 2010/03/12 6:47 UTC
Read the original article Hit count: 235

Filed under:
|
|

I want to filter some reserved word on my title form.

$adtitle = sanitize($_POST['title']);
$ignore = array('sale','buy','rent');
if(in_array($adtitle, $ignore)) {
$_SESSION['ignore_error'] = '<strong>'.$adtitle.'</strong> cannot be use as your title';
header('Location:/submit/');
exit;
  • How to make something like this. If user type Car for sale the sale will detected as reserved keyword.
  • Now my current code only detect single keyword only.

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays