valid chararcters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Davide

    valid chararcters

    Hi all.

    I'm writing a form which only these characters are alloved "a-z 0-9 -
    .."
    what function help me to do this?

    really thanx!

  • Juliette

    #2
    Re: valid chararcters

    Davide wrote:
    Hi all.
    >
    I'm writing a form which only these characters are alloved "a-z 0-9 -
    ."
    what function help me to do this?
    >
    really thanx!
    >
    When you've received the data validate it with preg_match, something
    like this (untested):

    if( preg_match( '/^[\.a-zA-Z0-9- ]+$/', $value ) === 1 ) {
    // data is valid
    }
    else {
    // data is invalid
    }

    Comment

    Working...