Jump to content

[SOLVED] Whats this called


Bendude14

Recommended Posts

I want to be able to select more than one item so a drop down box is not possible for this...i dont think.

 

I have seen it online where there is a scrolling list on the left and you can select multiple values and when you click add they move to a box on the right which i will then update to the DB when submitted

 

I dont even no what you would call this so was finding it hard to google.

 

thanks

Ben

Link to comment
Share on other sites

I'm not sure that it's called anything special... you just add the multiple tage inside your select and make the name an array.

 

example:

 

<?php

if ($_POST) { 
  print_r($_POST);
}

?>

<br />
<form action = '' method = 'post'>
   <select name = 'blah[]' multiple>
      <option value = 'a'>a</option>
      <option value = 'b'>b</option>
      <option value = 'c'>c</option>
   </select>
   <input type = 'submit' value = '>>'>
</form>

Link to comment
Share on other sites

The second is definetly JavaScript and it looks somthing like this:

<script language="javascript">
function copyChoices()
{
document.getElementByID('select').innerHTML = document.getElementByID('select2').innerHTML;
}
</script>
<form name="form1" method="post" action="">
<label>
<select name="select" size="5" multiple id="select">
	<option value="1">Item1 </option>
	<option value="2">Item2</option>
	<option value="3">Item3</option>
	<option value="4">Item4</option>
	<option value="5">Item5</option>
	<option value="6">Item6</option>
	<option value="7">Item7</option>
	<option value="8">Item8</option>
	<option value="9">Item9</option>
	<option value="10">Item10</option>
				</select>
</label>
<label>
<input type="submit" name="button" id="button" value=">" onClick="copyChoices()">
</label>
<label>
<select name="select2" size="5" id="select2">
</select>
</label>
</form>

As usual this is rough but this is basicly how it should be.

To select multiple you must have the multiple in the tag <select name="select" size="5" multiple id="select">

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.