Results 1 to 5 of 5

Thread: Help please

  1. #1
    Join Date
    Aug 2007
    Posts
    185
    Tokens
    0

    Default Help please

    Code:
    $badnames = array('bob', 'jim', 'sam');
    Code:
    if($username == $badnames){
    echo("That username is unavailable!<br><br>");
    }
    How can i make it check if $username is equal to any of the words in $badnames?

    Moved by H0BJ0B (Forum Moderator) from Designing & Development: Please post in the correct forum next time, thanks .
    Last edited by H0BJ0B; 20-01-2008 at 11:09 PM.

  2. #2
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    PHP Code:
    if( in_array$username$badnames ) )
    {

        echo(
    "That username is unavailable!<br><br>");


    EDIT: Forgot part of the function.
    Last edited by Invent; 20-01-2008 at 10:24 PM.

  3. #3
    Join Date
    Aug 2007
    Posts
    185
    Tokens
    0

    Default

    That will never work it's not even checking the $badnames...

    Doesn't work.


    Edited by H0BJ0B (Forum Moderator): Posts Merged. Please do not double post within the 15 minute editing time. Instead, click "edit" on your first post.
    Last edited by H0BJ0B; 20-01-2008 at 11:06 PM.

  4. #4
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    There I misunderstood what your script was doing. It should work now.

  5. #5
    Join Date
    Aug 2007
    Posts
    185
    Tokens
    0

    Default

    That works thanks

    But how now would i make it so if it contains a word from an array?

Posting Permissions

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