I found this neat code online that does exactly what I need. The problem I'm having is that the variable is not passing the entire value.
<script type='text/javascript'>
$(window).load(function() {
$("#add_id").click(function() {
var value = $("#entered_id").val();
$("#list_id").append("<option value =" + value + " selected>" + value + "</option>");
});
});
</script>
<select id='entered_id'>
<option value='This is a test message'>test</option>";
</select>
<button id="add_id">Add</button>
<h2>Entered IDs</h2>
<form name="test" method="POST" action="test2.php">
<select id="list_id" name="list_id" multiple="multiple"> </select>
<input type="submit" />
</form>
On test2.php
the variable $list_id
comes in as "This" instead of "This is a test".
Can anyone steer me in the right direction?