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!
and here is explaination for the above regular expression:
^[a-zA-Z ]*?$
Assert position at the start of the string «^»
Match a single character present in the list below «[a-zA-Z ]*?»
Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
A character in the range between "a" and "z" «a-z»
A character in the range between "A" and "Z" «A-Z»
The character " " « »
Assert position at the end of the string (or before the line break at the end of the string, if any) «$»
and then type some values and hit submit you will see error message if you input inappropriate values.
Just for the name field, if you type one string without any space you don't get any error message but if you type two or more string with space in between them the error message it gives is "please type character value for name field".
So if you input "John" not a problem, but if you type "John Smith" you get that error massage. But apart from that, if you type other values like numeric or alpha numeric for the name field the function serves the purpose and gives you an error message.
I just need something that will say okay if the value is a string no matter if there is space or not.
The functions I have consulted none of them have got this built-in. I dont want to re invent the wheel so just looking around if someone already done it.