Ok I have it sort of working
$sql = "select * from messages where id = '".$_POST['id']."' or from = '". $_POST['from'] ."' or subject LIKE '%". $_POST['subject'] ."%' or message LIKE '%". $_POST['message'] ."%' ORDER BY id DESC";
But the problem is when I do a from search it comes back with all sorts, which I have tracked down to subject and message being blank on the search page.
How can I make sure that subject and message has something when doing the query?