Check Entry for blank spaces

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phpmind
    New Member
    • Feb 2008
    • 16

    Check Entry for blank spaces

    I have a signup form that I want to validate and check to make sure the user has entered in a character field than contains no spaces.
    Example
    If MyColumn is entered in as: This is My Row
    I want to send an error message back to the user that this entry cannot contain any spaces

    In other words this entry should be: ThisisMyRow

    Im sure this is probably very simple, your feedback is appreciated.
  • satas
    New Member
    • Nov 2007
    • 82

    #2
    [PHP]
    $userText = trim($_GET['userText']);
    if (strpos($userTe xt, " ") !== false) {
    print "Text contains spaces";
    }
    [/PHP]

    Comment

    • phpmind
      New Member
      • Feb 2008
      • 16

      #3
      That worked perfect

      Thanks!

      Comment

      Working...