hey can any 1 tell me how i can validate a name field to allow only alphabets and spaces.i tried this

else if(ereg('[ ^ A-Za-z ]', $name)) 
    {echo "<h5>YOU CAN ENTER ONLY ALPHABETS</h5>";
	$errCnt++;
	}

but this allows only alphabets.i cannot enter a space

Recommended Answers

All 2 Replies

solved it.jus had to replace ereg with prg_match

solved it.jus had to replace ereg with prg_match

then mark as solved. it could be help ful to others may be you have it in the future. ha....just send the solved code and mark as solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.