SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot m0h's Avatar
    Join Date
    Sep 2001
    Location
    Cairo, Egypt
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    trying to use strcasecmp()!

    hello there
    I'm trying to use strcasecmp() to check if the right code is entered or not
    PHP Code:
    $code1 "code1";
    $code2 "code2";
    if (!
    strcasecmp($joincode$code1) and !strcasecmp($joincode$code2)){ 
    error("Wrong Join Code!");
    }
    echo 
    "Ok"
    if I use code1 or code2 it echo Ok, but if i use any other word it also echo Ok!
    what is wrong with my code?

    Thanx!
    - m0h

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you need an else.

    hadley

  3. #3
    SitePoint Zealot m0h's Avatar
    Join Date
    Sep 2001
    Location
    Cairo, Egypt
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I don't
    any way I solved it using this:
    PHP Code:
    $joincode strtolower($joincode); 
    if (
    $joincode != "code1" and $joincode != "code2"){
    error("Wrong Join Code!");

    Thanx
    - m0h


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •