Hi

i have a user form, one part is a textarea where the user tpes in information. If they just enters spaces rather than text, i want a error to appear and not accept it, what code do i need??

if (preg_match ("/^ /" , $text entry) == 0)
{
echo "You only entered spaces!";
}

I think using trim is a better option. You stripe tab, newline and so on as well.

$textentry = trim($textentry);
if ($textentry == "") echo "Nothing entered";
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.