dvayne Posted April 21, 2008 Share Posted April 21, 2008 I want to select names that are checked (multiple checkbox).. any help would be appreciated.. thanks Link to comment https://forums.phpfreaks.com/topic/102123-selecting-checked-checkbox/ Share on other sites More sharing options...
zenag Posted April 21, 2008 Share Posted April 21, 2008 <? $check=$_POST["check"]; $chk=implode(",",$check); echo $chk; ?> <form action="" method="post"> <input type="checkbox" name="check[]" id="check" value="hai" >hai <input type="checkbox" name="check[]" id="check" value="how">how <input type="checkbox" name="check[]" id="check" value="are">are <input type="checkbox" name="check[]" id="check" value="you">you <input type="submit" name="submit" value="submit"> </form> Link to comment https://forums.phpfreaks.com/topic/102123-selecting-checked-checkbox/#findComment-522735 Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 On the HTML form, name use this instead of a normal input: <input type="checkbox" name="interests[]" value="Music" /> Music Just an example. Notice the name, with the [] on the end. To use that in PHP, do this: <?php foreach ($_POST['interests'] as $key=>$value) { //do something with $value } ?> Link to comment https://forums.phpfreaks.com/topic/102123-selecting-checked-checkbox/#findComment-522736 Share on other sites More sharing options...
dvayne Posted April 22, 2008 Author Share Posted April 22, 2008 if I check one or more checkbox then I select yes in dropdown then I click the submit button, the usergroup of the checked names will be updated to verified member.. any help would be appreciated.. Link to comment https://forums.phpfreaks.com/topic/102123-selecting-checked-checkbox/#findComment-523492 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.