Multi Checkbox

Hi

I'm sure I have done this before but I can't find the code.
I have form with 10 checkboxes on it, the name of
the checkboxes are the same but the values are
different.

Im sure these would be submitted as an array, but
how do I get the value out of each one?
I think its something like

foreach($checkbox) {
$output .= $checkbox
}

But it's not working, what am I missing here?

Thanks

Brian



------------------------------------------------------------ --------------------
I am using the free version of SPAMfighter for private users.
It has removed 1144 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
Brian [ Mi, 10 Januar 2007 14:38 ] [ ID #1591148 ]

Re: Multi Checkbox

Brian wrote:
> Hi
>
> I'm sure I have done this before but I can't find the code.
> I have form with 10 checkboxes on it, the name of
> the checkboxes are the same but the values are
> different.
>
> Im sure these would be submitted as an array, but
> how do I get the value out of each one?
> I think its something like
>
> foreach($checkbox) {
> $output .= $checkbox
> }
>
> But it's not working, what am I missing here?

Did you remember to do

$checkbox=$_REQUEST['checkbox'];

--

//Aho
Shion [ Mi, 10 Januar 2007 14:49 ] [ ID #1591149 ]

Re: Multi Checkbox

"J.O. Aho" <user [at] example.net> wrote in message
news:50k970F1fsiqtU1 [at] mid.individual.net...
> Brian wrote:
>> Hi
>>
>> I'm sure I have done this before but I can't find the code.
>> I have form with 10 checkboxes on it, the name of
>> the checkboxes are the same but the values are
>> different.
>>
>> Im sure these would be submitted as an array, but
>> how do I get the value out of each one?
>> I think its something like
>>
>> foreach($checkbox) {
>> $output .= $checkbox
>> }
>>
>> But it's not working, what am I missing here?
>
> Did you remember to do
>
> $checkbox=$_REQUEST['checkbox'];
>

I hadn't, but have now tried this and still get an error,
I know it's something really simple I'm missing here

$information = $_REQUEST['information'];
foreach($information){
$output .= "$information<br>";
}

Brian



------------------------------------------------------------ --------------------
I am using the free version of SPAMfighter for private users.
It has removed 1146 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
Brian [ Mi, 10 Januar 2007 15:07 ] [ ID #1591152 ]

Re: Multi Checkbox

Brian wrote:
> "J.O. Aho" <user [at] example.net> wrote in message
> news:50k970F1fsiqtU1 [at] mid.individual.net...
>> Brian wrote:
>>> Hi
>>>
>>> I'm sure I have done this before but I can't find the code.
>>> I have form with 10 checkboxes on it, the name of
>>> the checkboxes are the same but the values are
>>> different.
>>>
>>> Im sure these would be submitted as an array, but
>>> how do I get the value out of each one?
>>> I think its something like
>>>
>>> foreach($checkbox) {
>>> $output .= $checkbox
>>> }
>>>
>>> But it's not working, what am I missing here?
>> Did you remember to do
>>
>> $checkbox=$_REQUEST['checkbox'];
>>
>
> I hadn't, but have now tried this and still get an error,
> I know it's something really simple I'm missing here
>
> $information = $_REQUEST['information'];
> foreach($information){
> $output .= "$information<br>";
> }

In the input tags you use the name="information[]" ?


--

//Aho
Shion [ Mi, 10 Januar 2007 16:12 ] [ ID #1591153 ]

Re: Multi Checkbox

..oO(Brian)

>I hadn't, but have now tried this and still get an error,
>I know it's something really simple I'm missing here
>
>$information = $_REQUEST['information'];
> foreach($information){
> $output .= "$information<br>";
> }

foreach ($_REQUEST['information'] as $information) {
$output .= "$information<br>";
}

Micha
Michael Fesser [ Mi, 10 Januar 2007 16:18 ] [ ID #1591154 ]

Re: Multi Checkbox

"Michael Fesser" <netizen [at] gmx.de> wrote in message
news:2s0aq2hbtcpkhhjppacaleeskok5sff63i [at] 4ax.com...
> .oO(Brian)
>
>>I hadn't, but have now tried this and still get an error,
>>I know it's something really simple I'm missing here
>>
>>$information = $_REQUEST['information'];
>> foreach($information){
>> $output .= "$information<br>";
>> }
>
> foreach ($_REQUEST['information'] as $information) {
> $output .= "$information<br>";
> }
>

I hadn't put the [] on the form, now working :)

Thanks Guys

Brian



------------------------------------------------------------ --------------------
I am using the free version of SPAMfighter for private users.
It has removed 1146 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
Brian [ Mi, 10 Januar 2007 18:14 ] [ ID #1591157 ]
PHP » alt.php » Multi Checkbox

Vorheriges Thema: How can i convert media (mpeg,mp3 etc) files in to swf by php programming?
Nächstes Thema: [PHP4] Upload progress meter