Re: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread Mark
First try isset($product) to see if it's being POSTed or GETted
properly. You might need to use $_POST['products'] or
$_GET['products'].


--- Aaron Wolski [EMAIL PROTECTED] wrote:
 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
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to death to 
defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




RE: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread Hutchins, Richard
What about:

count($arrayname)

Should tell you how many items are in an array.

 -Original Message-
 From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 05, 2003 4:04 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 
 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




Re: [PHP-DB] checking for empty array from a form field?grrrrrrrrrrr!

2003-02-05 Thread Mignon Hunter
I usually use:

while(list($key,$value) = each($products)) {
echo $key:$value;
}


On Wed, 2003-02-05 at 15:03, Aaron Wolski wrote:
 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
-- 
Mignon Hunter
Web Developer
Toshiba International
713.466.0277 x 3461


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




RE: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread Aaron Wolski
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:[EMAIL PROTECTED]] 
Sent: February 5, 2003 4:03 PM
To: 'Aaron Wolski'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] checking for empty array from a form field?
grrr!

What about:

count($arrayname)

Should tell you how many items are in an array.

 -Original Message-
 From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 05, 2003 4:04 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 
 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




RE: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread jay
to find out if an array is empty use:
empty()

it must be unset
NULL returns false
0 returns false
it must be truly empty to return true...



 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:[EMAIL PROTECTED]]
 Sent: February 5, 2003 4:03 PM
 To: 'Aaron Wolski'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 What about:
 
 count($arrayname)
 
 Should tell you how many items are in an array.
 
  -Original Message-
  From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, February 05, 2003 4:04 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] checking for empty array from a form field?
  grrr!
 
 
  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

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




RE: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread Hutchins, Richard
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:[EMAIL PROTECTED]]
 Sent: Wednesday, February 05, 2003 4:53 PM
 To: 'Hutchins, Richard'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 
 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:[EMAIL PROTECTED]] 
 Sent: February 5, 2003 4:03 PM
 To: 'Aaron Wolski'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 What about:
 
 count($arrayname)
 
 Should tell you how many items are in an array.
 
  -Original Message-
  From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, February 05, 2003 4:04 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] checking for empty array from a form field?
  grrr!
  
  
  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




RE: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread Aaron Wolski
Well well well.. with the help of someone else pointing me in a
different direction altogether here's what we came up with that totally
works!


$PRODUCT_SELECTED = TRUE;

foreach($products as $value) {

if(empty($value)) {

$PRODUCT_SELECTED = FALSE;
}

last;

}

if(!$PRODUCT_SELECTED) {

$productQuery = db_query(SELECT name FROM CartTable
WHERE submitted=1 GROUP BY name);
while ($productResult = db_fetch($productQuery)) {

$products[] = $productResult[name];

}

$prod_search = in(;
for ($i=0;$icount($products);$i++) {

$prod_search .=
escapeQuote($products[$i]);
if ($i !=
(count($products) - 1)) {
$prod_search .=
,;
}
}

$prod_search .= );

$product = AND name $prod_search;

}

else {

$prod_search = in(;
for ($i=0;$icount($products);$i++) {   
$prod_search .= escapeQuote($products[$i]);
if ($i != (count($products) - 1)) {
$prod_search .= ,;
 }
}

$prod_search .= );

$product = AND name $prod_search;
  
}

Thanks to all for their support and help on this. Longest 4 hours of my
life :(

Aaron

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] 
Sent: February 5, 2003 4:53 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] checking for empty array from a form field?
grrr!

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:[EMAIL PROTECTED]]
 Sent: Wednesday, February 05, 2003 4:53 PM
 To: 'Hutchins, Richard'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 
 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:[EMAIL PROTECTED]] 
 Sent: February 5, 2003 4:03 PM
 To: 'Aaron Wolski'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] checking for empty array from a form field?
 grrr!
 
 What about:
 
 count($arrayname)
 
 Should tell you how many items are in an array.
 
  -Original Message-
  From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, February 05, 2003 4:04 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] checking for empty array from a form field?
  grrr!
  
  
  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




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




Re: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread Jeff Pauls
try :

if (strlen($products) == 0) {
 
echo nothing entered in field;
}


http://www.php.net/manual/en/function.strlen.php


Jeff


- Original Message - 
From: Aaron Wolski [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 05, 2003 3:03 PM
Subject: [PHP-DB] checking for empty array from a form field? grrr!


 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