That won't work. For a start you would need to quote the strings, or they are considered as (undefined) constants. Secondly, you would need to say
if ( $postcode == "BN" || $postcode == "CR" // etc
otherwise each check after the first would not actually compare against $postcode.
A neater approach might be to use an array to contain the postcodes.
function valid_postcode($postcode)
{
$postcodes = array ("BN", "CR", "GU"); // etc
if(in_array($postcode, $postcodes))
{
return true;
}
return false;
}