Re: what is wrong?
| From: | lallous | Date: | Thu, 12 Sep 2002 11:20:55 +0000 |
| Subject: | Re: what is wrong? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116129@lists.php.net to get a copy of this message | ||
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" <erwin@isiz.com> wrote in message
news:20020912101336.25154.qmail@pb1.pair.com...
> 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
>