I've been working with PHP for a couple years and I've come a long way. I'm building a site right now, and doing something that seems quite basic, yet its not working. Here's my code:
<?
$ziplength = strlen($zipcode) ;
if($ziplength < 5) { $badzip = "Yes" ; }
if($zipcode == "") { header('location: index.php?error=1') ; }
if($badzip == "Yes") { header('location: index.php?error=1') ; }
setcookie('xxxxxxxxx', $zipcode) ;
header('location: categories.php?ziplength=' . $ziplength . '&badzip=' . $badzip . '&') ;
?>
What's weird is that even though both IF statements might be True, the 'headers' associated with them don't work. For some reason, it skips right to the bottom and hits the last header. Then in that header, the ziplength might still be less than 5 and badzip might equal Yes. This seems so simple, but it won't work. Any ideas?