Re: Re: syntax for checking if string contains something

From: Date: Tue, 23 Oct 2001 03:37:26 +0000
Subject: Re: Re: syntax for checking if string contains something
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-71891@lists.php.net to get a copy of this message
Thanks for your reply. But I tried it and it seems to pass right through the if condition without checking if the string is empty or not. Here is another PHP file where I tried using the "empty" function The input form contains the following: <h2>QTY:</h2><input type="text" name="qty" size=7><br> Here is the part that checks whether or not the user has pressed "submit" and checks if "$qty" is empty or not: 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. Any suggestions? thanks. On Mon, 22 Oct 2001, CC Zona wrote: > In article <Pine.LNX.4.21.0110230300370.19442-100000@ns.visors.com.hk>, > php_guy@visors.com.hk (Peter) wrote: > > > for example > > if ($email =="") > > > > checks if the $email variable was inputted by the user. > > Better: if(!empty($email)) > <http://php.net/empty> > > > However I was wondering how can I refine it so that it will also check if > > the $email variable contains an '@' sign? > > <http://php.net/strstr> > >

« previous php.general (#71891) next »