Re: [PHP] implode errors if array empty
From: "Marek Kilimajer" <[EMAIL PROTECTED]> [EMAIL PROTECTED] wrote: resolved with if(empty()) - apologies. isset() is more apropriate as $enterprise is not defined at all, empty() will issue a notice. No it won't. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] implode errors if array empty
[EMAIL PROTECTED] wrote: resolved with if(empty()) - apologies. isset() is more apropriate as $enterprise is not defined at all, empty() will issue a notice. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] implode errors if array empty
Hello, I suppose the $enterprise variable doesn't hold an empty array but is not defined and because of this you get the error. Test with the following example: It does not send any errors back. If you substitute $array = array(); with $array = ""; you'll get a woarning: "Warning: implode(): Bad arguments. in temp.php on line 4". Just have in mind that when posting multiple select fields and no options are selected - you simply have no corresponding value in the _POST array (or in the $enterpise variable if you're using register_globals). There's no empty array but nothing defined. On Wednesday 22 September 2004 13:16, [EMAIL PROTECTED] wrote: > hi there, > > i am using implode to get the contents of an array into a single variable: > > $enterprises = implode(",", $enterprise) //enterprise contains the array. > > however, if the array is empty (the user didnt select anything in the > form), the implode function errors out. > > can anyone think of a way round this? > > many thanks, > > luke m. -- Cyberly yours, Petar Nedyalkov Devoted Orbitel Fan :-) - Orbitel - the New Generation Telecom! See www.orbitel.bg. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] implode errors if array empty
resolved with if(empty()) - apologies. [EMAIL PROTECTED] wrote: > hi there, > > i am using implode to get the contents of an array into a single variable: > > $enterprises = implode(",", $enterprise) //enterprise contains the array. > > however, if the array is empty (the user didnt select anything in the form), > the implode function errors out. > > can anyone think of a way round this? > > many thanks, > > luke m. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] implode errors if array empty
hi there, i am using implode to get the contents of an array into a single variable: $enterprises = implode(",", $enterprise) //enterprise contains the array. however, if the array is empty (the user didnt select anything in the form), the implode function errors out. can anyone think of a way round this? many thanks, luke m. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php