Array in a input transfered via post
| From: | Kim Noer | Date: | Fri, 21 Jul 2000 15:38:07 +0000 |
| Subject: | Array in a input transfered via post | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7585@lists.php.net to get a copy of this message | ||
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