array?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

array?

Post by pinehead18 »

I have a checkbox area that allows a person to select 8 differnt options. all the check boxes have the same variable name. How do i get that one variable to list all the selected check boxes in that one name?

is that an array if so what type?

thank you
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

<input type="checkbox" name="your_array_name&#1111;]" value="larry" />
<input type="checkbox" name="your_array_name&#1111;]" value="moe" />
<input type="checkbox" name="your_array_name&#1111;]" value="curly" />
<input type="checkbox" name="your_array_name&#1111;]" value="shemp" />
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post by pinehead18 »

$music_array = array('music[0]');
$music = implode(',', $music_array);

Ok i had music[] and then i changed it to music[0]

however, this does not work. What i'm trying to accomplish is to seperate all the "values" in the "name" with a comma.

Thanks for the help.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

$commas = join(',', $_POST&#1111;'your_array_names']);
basically..
Post Reply