POST contents of a listbox
Hi!
I have a dual listbox thing where the left and right is populated from a database. There's some buttons and a bit of JS that allows items to move left and right between the two. Basically copied this and added my own database logic: https://codepen.io/afrost/pen/EyQOxx
My data/schema is pretty simple - id# and a name.
What I want to do (ultimately) is insert the id's of the contents of the right listbox to a database. If I can get the id's into a variable/array, I'll be able to go from there. Does that make sense?
Test code is below - I've had to trim it because of the 2000char limit but it should have the pertinent bits. I'll add the missing bits below if needed. The left list populates correctly and I can move items left and right as I wish. I want to extract the contents of the rightmost column on a 'submit'.
cheers!
I have a dual listbox thing where the left and right is populated from a database. There's some buttons and a bit of JS that allows items to move left and right between the two. Basically copied this and added my own database logic: https://codepen.io/afrost/pen/EyQOxx
My data/schema is pretty simple - id# and a name.
What I want to do (ultimately) is insert the id's of the contents of the right listbox to a database. If I can get the id's into a variable/array, I'll be able to go from there. Does that make sense?
Test code is below - I've had to trim it because of the 2000char limit but it should have the pertinent bits. I'll add the missing bits below if needed. The left list populates correctly and I can move items left and right as I wish. I want to extract the contents of the rightmost column on a 'submit'.
cheers!
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script>
the JS from that URL.
</script>
<form action="/lists.php" method="POST">
<div class="approveTermsContainer">
<div class="newItems">
<b>Available organisations:</b><br/>
<select multiple="multiple" id="lstBox1">
<?php
foreach ($orgs as $row) {
echo '<option value="'.$row["id"].'">'.$row["name"].'</option>';
}
?>
</select>
</div>
<div class="transferBtns">
<input type='button' id='btnRight' value =' > '/>
<br/><input type='button' id='btnLeft' value =' < '/>
<div class="submitContainer">
<input type="submit" value = "submit"/>
</div>
</div>
<div class="approvedItems">
<b>Selected Organisations: </b><br/>
<select multiple="multiple" id="lstBox2" name="AdminOrgs">
</select>
</div>
</div>
</form>
