Re: Array in a input transfered via post
| From: | Jeff Warrington | Date: | Fri, 21 Jul 2000 19:38:42 +0000 |
| Subject: | Re: Array in a input transfered via post | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7614@lists.php.net to get a copy of this message | ||
In article <8l9qpj$l5f$1@toye.php.net>, kn@nospam.dk ("Kim Noer") wrote:
perhaps I am not clear here on what you are trying to accomplish,
but the examples I have seen and the code I have written look
like this:
<input type='checkbox' name='checkboxen[]' value='hello'>
This means that you should have an array on the action page
of the form that should contain the checked inputs.
Jeff
> Hey there!
>
> I'm having a small problem with:
>
> <input type="checkbox" name="somearray[name]"
> value="nisse">
> <input type="checkbox" name="somearray[name]" value="mand">
> <input type="checkbox" name="somearray[name]"
> value="etcetc">
> ....
>
> It works, as long as I referr to to somearray[name] - but I can't use a
> number instead.
>
> Example:
>
> for ($i=0; $i < sizeof(somearray); $i++) {
> echo somearray[$i];
> }
>
> That doesn't work - what do I do about that? I could of course create a
> new array which can use numbers as a key like this:
>
> $newsomearray = array_values($somearray);
>
> Which I then could use in a for loop.
>
> But - the question is- can I avoid that? I'm not terrible experinced in
> PHP, as you might have discovered :)
>
> --
> Why is a 0 slimmer than an O? What if 0 believes it looks like O - then
> 0 would have a problem right?
> CPU stuff : http://home.worldonline.dk/~noer
>
>
>
>