Re: Re: syntax for checking if string contains something
| From: | liljim | Date: | Tue, 23 Oct 2001 08:35:38 +0000 |
| Subject: | Re: Re: syntax for checking if string contains something | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71917@lists.php.net to get a copy of this message | ||
Hey,
> if (isset($submit)){
> if (!empty($qty))
> { echo "Please enter the quantity for your quotation enquiry.";}
>
>
> When nothing was filled in for $qty the if condition did not prompt me to
> enter a quantity.
This is wrong:
if (!empty($qty))
{ echo "Please enter the quantity for your quotation enquiry.";}
You're checking to see whether or not qty IS empty, this statement checks
for when when it is NOT empty
if (empty($string)) {
// This is an empty string.
}
if (!empty($string)) {
// This is NOT an empty string.
}
James