Re: brackets []
| From: | Micah Stevens | Date: | Tue, 25 Jan 2005 16:47:53 +0000 |
| Subject: | Re: brackets [] | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-38321@lists.php.net to get a copy of this message | ||
On Tuesday 25 January 2005 07:38 am, Craig Hoffman wrote:
> Quick question...
> I am hoping some could explain this to me. I have an array like this:
>
> $completed = array($value1, $value2, $value3);
>
> where the values are sent via a form.
> <input type="checkbox" name="completed[]" value="value1">
>
> when I do print_ r() to see what's in the array I get this:
> Array ( [0] => [1] => [2] => )
>
> An empty array. But when I do this:
Are you sure it's empty? If the checkbox is checked, they should contain the
value of that checkbox. That's my experience.
> $completed[] = array($value1, $value2, $value3);
>
> Array ( [0] => 1 [1] => 1 [2] => Done [3] => 2 [4] => 1 [5] => 3
> [6] => 1 [7] => 4 [8] => 1 [9] => Array ( [0] => [1] => [2] => )
> )
>
> I get a multidimensional array with keys and values. How can I get
> this array to be one dimensional?
$completed = array($value1, $value2, $value3);
your other assignment line is basically saying, let the first array value
equal another array of 3 values.
HTH
-Micah