Page 1 of 1

how do i alter this to alow spaces being entered

Posted: Fri Nov 13, 2009 5:03 pm
by chris_s_22
when a user enters something in a form it throws up a error if they use a space
how do i alow a it to have a space. also how would i alow it to have a comma as well
if(!preg_match("/^[a-z\d]{0,25}$/i", $_POST[feild1]))
{
// Reshow the form with an error
$feild1_error = "must only contain letter and numbers and be a max characters of 25 in length!<br />";
include 'profileeditform.php';
exit;
}

Re: how do i alter this to alow spaces being entered

Posted: Fri Nov 13, 2009 5:30 pm
by requinix

Code: Select all

/^[a-z\d ,]{0,25}$/i