grahamgr3 Posted February 8, 2014 Share Posted February 8, 2014 I want to create a contact form that has an email field where the user can't enter any white space in the field, for example: test@ex ample.com I am using a spam scrubbing function taught to us in the book to clean user inputs. I am using my variable like so. $email = strip_tags($scrubbed['email']); how can I add something like this $email = preg_replace('/\s+/', '', $email); to the existing $email = strip_tags($scrubbed['email']); I tried $email = (preg_replace('/\s+/', '', $email)(strip_tags($scrubbed['email']))); and all sorts of variations to that. it doesn't work. Link to comment Share on other sites More sharing options...
Larry Posted February 10, 2014 Share Posted February 10, 2014 Personally, I'd just apply the Filter extension. If it passes, it's syntactically valid. I don't see the argument for forcibly removing spaces form a submitted email address. Link to comment Share on other sites More sharing options...
Recommended Posts