how do i alter this to alow spaces being entered

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chris_s_22
Forum Commoner
Posts: 76
Joined: Wed Dec 31, 2008 2:05 pm

how do i alter this to alow spaces being entered

Post 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;
}
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

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

Post by requinix »

Code: Select all

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