I have been racking my brain for a bit and getting nowhere. I'm probably missing something really simple, but what I effectively need is.
if string 1 or 2 is set then compare with string 3 providing string 3 is not null.
if($_SESSION['code'] || $_GET['id'] <> $_POST['code'] && isset($_POST['code']))