Please tell me whats wrong with this code.......

Discussion in 'Programming' started by links121, Aug 3, 2011.

  1. #1
    Hi

    And thanks for dropping by..

    Okay i have this problem,i need to do some modifications in the registration page (zip code)it will only recognize us zip codes i need it to recognize uk postcode to heres the code


    if (!isNotNull($txtZIP)) {
            $message .= "* Zip cannot be empty! <br>";
        }
    	elseif($txtZIP==0 || (strlen($txtZIP)!=5 && $ddlCountry=="US"))
    	{	
    		 $message .= "* Enter valid Zip code! <br>";
    PHP:
    if anyone can help it would be very helpful

    Thanks
     
    links121, Aug 3, 2011 IP
  2. The Webby

    The Webby Peon

    Messages:
    1,852
    Likes Received:
    30
    Best Answers:
    1
    Trophy Points:
    0
    #2
    You probably need to change this line

    elseif($txtZIP==0 || (strlen($txtZIP)!=5 && $ddlCountry=="US"))

    it's checking whether zip is 0 or length of zip is not equal to 5 and country is US
    if true then it considers it as invalid zip..
     
    The Webby, Aug 3, 2011 IP
  3. i8k

    i8k Greenhorn

    Messages:
    58
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    looks like it should be

    if (is_null($txtZIP)) {
    Code (markup):
    and it's

     elsif 
    Code (markup):
    note missing the e
     
    i8k, Aug 3, 2011 IP
  4. links121

    links121 Well-Known Member

    Messages:
    266
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    121
    #4
    Thanks i have tried both of the above with no luck,

    thanks
     
    links121, Aug 4, 2011 IP