Terion Miller wrote:
> I changed the implode to :
> if (isset($_POST['BannerSize'])){$BannerSize = implode(',',
> $_POST['BannerSize']);} else {$BannerSize = "";}
> 
> now it says "Invalid Arguement" whereas when it was the other way it didn't
> 
> 

"Invalid Argument".  Then $_POST['BannerSize'] is not what it is expecting.

Run a is_array() on it before you are using it.
Something like the following should do.

if ( isset($_POST['BannerSize']) && is_array($_POST['BannerSize']) ) {
        $BannerSize = implode(',', $_POST['BannerSize']);
} else {
        $BannerSize = "";
}

You could also go a little further and do something like this...

if ( isset($_POST['BannerSize']) ) {
        if ( is_array($_POST['BannerSize']) ) {
                $BannerSize = implode(',', $_POST['BannerSize']);
        } else {
                $BannerSize = $_POST['BannerSize'];
        }
} else {
        $BannerSize = "";
}

The latter one would assume that you would only receive a valid string
instead of an array if $_POST['BannerSize'] was set at all.

so... YMMV

-- 
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare


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

Reply via email to