Page 1 of 1
i want to display 6 checkboxes in for loop with id
Posted: Fri Aug 11, 2006 4:59 am
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
Posted: Fri Aug 11, 2006 5:12 am
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>';
Posted: Fri Aug 11, 2006 5:13 am
by dotoho
u can writle more clearly what do u want .
I like to disscuss because now i am doing with check box
Posted: Fri Aug 11, 2006 5:14 am
by JayBird
...also read my Tutorial on Checkboxes and Radio buttons -
viewtopic.php?t=23586
Posted: Fri Aug 11, 2006 6:02 am
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.
Posted: Fri Aug 11, 2006 6:03 am
by JayBird