i want to display 6 checkboxes in for loop with id

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
phpchild
Forum Newbie
Posts: 20
Joined: Mon Jul 31, 2006 6:27 am

i want to display 6 checkboxes in for loop with id

Post by phpchild »

hi

i want to display some check boxes with id and i have to pass this id (which i selected ie) 3 check boxes)

it should be pass into the next page. please help me
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Code: Select all

$ids = range(1, 6);

foreach($ids as $id)
{
    echo '<input name="checkboxes[]" type="checkbox" value="'.$id.'" />';
}
then when you have submitted your form, you can access the ids in the checkboxes array

Code: Select all

echo '<pre>';
print_r($_POST['checkboxes']); //or $_GET depending on form method
echo '</pre>';
dotoho
Forum Newbie
Posts: 14
Joined: Tue Aug 08, 2006 5:12 am

Post by dotoho »

u can writle more clearly what do u want .
I like to disscuss because now i am doing with check box
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

...also read my Tutorial on Checkboxes and Radio buttons - viewtopic.php?t=23586
phpchild
Forum Newbie
Posts: 20
Joined: Mon Jul 31, 2006 6:27 am

Post by phpchild »

hi

thanks for ur reply.

this code is working. but how i seperate this is ids. because i have to pass this ids to mysql query.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Image
Post Reply