RE: checking for empty array from a form field? grrrrrrrrrrr!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Somebody else replied with isset($varname). Try that. The count() function
is working as expected (see
http://www.php.net/manual/en/function.count.php). So maybe it's not the best
choice for trying to find out what you want.

> -----Original Message-----
> From: Aaron Wolski [mailto:aaronjw@martekbiz.com]
> Sent: Wednesday, February 05, 2003 4:53 PM
> To: 'Hutchins, Richard'; php-db@lists.php.net
> Subject: RE:  checking for empty array from a form field?
> grrrrrrrrrrr!
> 
> 
> Ok... well
> 
> When I select the "select product" which has a option 
> value="" it tells
> me the count is one (1). If I select an ACTUAL product it tells me
> one(1) was select.. if I select two ACTUAL products it tells 
> me two (2)
> products were selected.
> 
> For SOME reason it doesn't seem to be recognizing that the option
> value="" is empty!
> 
> 
> Any more ideas??????
> 
> *sigh*
> 
> Aaron
> 
> -----Original Message-----
> From: Hutchins, Richard [mailto:Richard.Hutchins@Getingeusa.com] 
> Sent: February 5, 2003 4:03 PM
> To: 'Aaron Wolski'; php-db@lists.php.net
> Subject: RE:  checking for empty array from a form field?
> grrrrrrrrrrr!
> 
> What about:
> 
> count($arrayname)
> 
> Should tell you how many items are in an array.
> 
> > -----Original Message-----
> > From: Aaron Wolski [mailto:aaronjw@martekbiz.com]
> > Sent: Wednesday, February 05, 2003 4:04 PM
> > To: php-db@lists.php.net
> > Subject:  checking for empty array from a form field?
> > grrrrrrrrrrr!
> > 
> > 
> > Argh !!!!!!!!
> >  
> >  
> > HOW does one check for an array being empty from a form 
> > field??????????
> >  
> > Tried a billion different things and NOTHING works!!!!
> >  
> > I've tried:
> >  
> > if ($products == "\n") {
> >  
> > echo "hello";
> > }
> >  
> > else {
> >  
> >             echo "bye";
> >  
> > }
> >  
> >  
> > if ($products == "") {
> >  
> > echo "hello";
> > }
> >  
> > else {
> >  
> >             echo "bye";
> >  
> > }
> >  
> >  
> >  
> > if (empty($products)) {
> >  
> > echo "hello";
> > }
> >  
> > else {
> >  
> >             echo "bye";
> >  
> > }
> >  
> >  
> > if (!isset($products)) {
> >  
> > echo "hello";
> > }
> >  
> > else {
> >  
> >             echo "bye";
> >  
> > }
> >  
> >  
> > if (count($products) == 0) {
> >  
> > echo "hello";
> > }
> >  
> > else {
> >  
> >             echo "bye";
> >  
> > }
> >  
> >  
> > NOTHING works!!!
> >  
> > Any help.. puuulease?
> >  
> > Aaron
> > 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux