Jump to content

[SOLVED] Stuck, always gives an error


xiao

Recommended Posts

This is my function:

function regio($postcode){
    switch(TRUE){
        case($postcode<1000):
            //Invalid
            $regio = 0;
            break;
        case($postcode>999 && $postcode<1300):
            $regio = "Brussel";
            break;
       .....
        case($postcode>8999 && $postcode<10000):
            $regio = "Oost-Vlaanderen";
            break;
        default:
            //Invalid
            $regio = 0;   
            break;
    }
    return $regio; 	
}

And I use this code:

$regio = regio($postcode);
//Kijken of regio geldig is
if($regio == 0){
$msg = "<p class='fail'>Invalid Postal Code!</p>";
}else{
...

 

I used this to test: $postcode = 2000

I always get the "Invalid Postal Code!" message...

Even when I change $regio = 0 in my function to $regio = 1

:-\

I'm sure it's something really noobish, but what am I doing wrong here?  ???

Link to comment
https://forums.phpfreaks.com/topic/82100-solved-stuck-always-gives-an-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.