Jump to content

making select options to checkboxes


liquidkrep

Recommended Posts

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
Share on other sites


<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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.