I'ld also add isset() to avoid warnings too:

if (isset($_POST['new_password1']) &&
!empty(trim(isset($_POST['new_password1']))))
{
  echo "i am not empty, you can do whatever";
}
else
{
  echo "i am empty! show error message";
}

"Erwin" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Meltem Demirkus wrote:
> > Hi,
> > I want to understand what is wrong with this code?I am trying to
> > understand when an empty inputs come from form and I will then give a
> > warning message..
> >
> > if($_POST[new_password1] == "   ")
> >
> > echo "empty input";
>
> And as final addition, you probably have to use
>
> $_POST["new_password1"]
>
> Besides that, I would use the form of Lallous:
>
> if ( empty( trim( $_POST[ "new_password1" ] )
>     echo "Empty!";
>
> HTH
> Erwin
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to