SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict -Ice-php's Avatar
    Join Date
    May 2002
    Location
    UK
    Posts
    260
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can i stop people putting spaces in their nickname?

    Hey
    i have a form and when they input their usename.
    How can i stop them from putting spaces in their name (not really stop them just echo name cannot contain spaces) ?
    Thanks
    -Ice

  2. #2
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    one way could be:

    PHP Code:
    <?php
    $my_string 
    "this is my nick name";

    if ( 
    preg_match"/\\s/"$my_string ) )
    {
        print 
    "Sorry, but the name cannot contain spaces!!!";
    }
    ?>
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  3. #3
    SitePoint Addict -Ice-php's Avatar
    Join Date
    May 2002
    Location
    UK
    Posts
    260
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks
    Works Great
    -Ice


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
  •