liquidkrep Posted September 15, 2009 Share Posted September 15, 2009 How can change this code which is multiple select options to checkboxes instead; <fieldset> <legend>Create a contact list</legend> <div> <label for="contacts">Available contacts</label> <span class="input"> <select id="contacts" name="contacts[]" multiple="multiple"> <?php if(!count($contacts)): ?> <option>No emails available</option> <?php else: ?> <?php foreach($contacts as $contact): ?> <option value="<?php echo $contact['recipient_id']; ?>"><?php echo $contact['email']; ?></option> <?php endforeach; ?> <?php endif; ?> </select> </span> </div> </fieldset> Can anyone help me out? Link to comment https://forums.phpfreaks.com/topic/174272-making-select-options-to-checkboxes/ Share on other sites More sharing options...
seventheyejosh Posted September 15, 2009 Share Posted September 15, 2009 <fieldset> <legend>Create a contact list</legend> <div> <label for="contacts">Available contacts</label> <span class="input"> <?php if(count($contact)<1){ echo 'No emails available'; }else{ foreach($contacts as $contact){ echo '<input type=checkbox value="'.$contact['recipient_id'].'" name="'.$contact['recipient_id'].'" /> '.$contact['email'].'<br />'; }//end foreach }//end if ?> </span> </div> </fieldset> like so? Link to comment https://forums.phpfreaks.com/topic/174272-making-select-options-to-checkboxes/#findComment-918675 Share on other sites More sharing options...
liquidkrep Posted September 15, 2009 Author Share Posted September 15, 2009 I tried this instead; <fieldset> <legend>Create a contact list</legend> <div> <label for="contacts">Available contacts</label> <span class="input"> <?php if(!count($contacts)): ?> <?php else: ?> <?php foreach($contacts as $contact): ?> <input type="checkbox" value="<?php echo $contact['recipient_id']; ?>" name="contacts[]" /><?php echo $contact['email']; ?><br /> <?php endforeach; ?> <?php endif; ?> </span> </div> </fieldset> I think the issue is now that the javascript button will not let me submit the form even though I have the checkbox checked. Link to comment https://forums.phpfreaks.com/topic/174272-making-select-options-to-checkboxes/#findComment-918706 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.