$html = $_POST['user_input'];
// either turn turn everything that you can into html entities (such as <)
$html = htmlentities($html); // do check the php doc. there's an option for converting ' or " or both
// or just deal with < and >
$html = str_replace(array('<', '>'), array('<', '>'), $html);
But if you don't translate certain other characters, your code will not validate. E.g. '&' needs to be translated into '&'