0

I was trying to trim white spaces from all sides but allow the single spaces between the words typed?

I am using the following code:

if(!preg_match('/^[A-Za-z0-9_]+$/',$_POST['username'])){
        if($stmt->execute()){
            $_SESSION['notmet'] = "Invalid username. You can only use letters and/or digits";
            header('location: index.php');}}

What am I exactly getting wrong here?

Monolica
  • 115
  • 7

0 Answers0