Eep, post timeout :@ I was going to say, you could extend it to easily use a few POST variables nicely: $where_checks = array( // POST variable => corresponding field in table 'name' => 'Name', 'job' => 'Job' ); $where = '1'; foreach ($where_checks as $post_var => $where_var) { if (!empty($_POST[$post_var])) $where .= ' AND ' . $where_var . ' = "' . mysql_real_escape_string($_POST[$post_var]) . '"'; } $query = ' SELECT * FROM Humans WHERE ' . $where; :)