Hi all,
How do I ensure users cannot register details with a space.
e.g. I want to allow the to register 'todaysdate' rather than 'todays date'
Their entry is entered into mysql db.
Thanks.
Kevin.
[man]strpos[/man]
$myString = str_replace(" ", "", $myString);
Is this correct?
$username = $_POST['username'] $username = str_replace(" ", "", $username);
Also how do I prevent numbers being entered into the textfield?
Thanks again.
Using the str_replace method will confuse users, you would be best to use the method suggested by Weedpacket and notify the user that they cannot use spaces in there name.
OK trying the strpos. How do I ensure no numbers inserted? Is the below correct?
$mystring = 'pggg456'; $findme = '[0-9]'; $pos = strpos($mystring, $findme);
How about you start out by asking the question you actually want answered? [man]preg_match[/man] or [man]strspn[/man].