0

hey all.

I am trying to do validation via PHP for submitted forms. Below is my own code, please comment if its the correct method or not.

However, I tried so many ways to have the /n or /r added, but I cant get to it.

Its just to make a new paragraph. Currently, it does the validation, but once I hit the enter key twice, for a new paragraph, it doesnt work the way it should.

Any help and advice appreciated.

Thanx

function validateText($data){
		//if it's NOT valid
		if(ereg('[^a-zA-Z0-9 .,-_]', $data))
			return false;
		//if it's valid - Must contain only alphabetical characters a-z, numerical numbers 0-9, spaces, commas, fullstops, dashes and underscores (abc123 ,._-)
		else
			return true;
}
3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by sallecpt
0

thanx man.

in regards with the other post, no its not.

I am submitting plain text, and I just want to know how to alter the ereg syntax so that it will allow the /n/r tags too.

I got it working in javascript, but I dong get the solution for php validation.

Thanx.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.