Re: isset and multiple selects
| From: | Jens Nedal | Date: | Sun, 11 Mar 2001 13:24:57 +0000 |
| Subject: | Re: isset and multiple selects | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43384@lists.php.net to get a copy of this message | ||
on 10.03.2001 10:10 Uhr, Alexander Lohse at al@humantouch.de wrote:
> Hi,
>
> is it a fact that: If I have multiple select with e.g. "pers[]" as
> name, I cannot check for an isset($pers) if the user left the field
> blank?
>
> I know it all works with textfields ... But in this case isset()
> seems not work. There is also no entry in HTTP_POST_VARS for that.
>
> Or might this be a browserspecific problem? (MSIE 5 on Mac)
>
> Regards,
Hi Alex,
In a multiple select those values are stored in array. That array is you
pers[].
In $HTTP_POST_VARS this will appear as this array, i.e. pers()
To list the values in the multiple select do this:
while(list($key,$value) = each(pers)) {
echo("$key -> $value");
}
or instead of echo you can assign those values newly or store them in a
database for example.
all the values look something like this in the array
pers[0] = 1. multiple select
pers[1] = 2. multiple select
pers[2] = 3. multiple select
pers[3] = 4. multiple select
regards, Jens
>
> Alex