help with javascript function that selects all options in a <select multiple> on submit

I want all the options selected when the user clicks the submit button so that in PHP i can get all the values that were in the list without the user having to highlight them.


foreach ($_POST['right'] as $selectedOption) {

echo $selectedOption."<br>";




function selectAllOptions(obj) {

if (!hasOptions(obj)) { return; }

for (var i=0; i<[url removed, login to view]; i++) {

[url removed, login to view][i].selected = true;




<form name='dealerform' id='dealerform' method=post action='[url removed, login to view]' onsubmit='selectAllOptions(right)'>

Offices -------------------------------------------------------------------> Selected Offices<br />

<table border="0" cellpadding="3" cellspacing="0"><tr><td>

<select multiple style='width: 277px;' size="20" name="left[]">


$sql="select officeid,name from office where officeid not in (select officeid from office_dealer) order by name";

if (!$result = $mysqli->query($sql)) { echo "Error selecting offices"; exit; }

while ($row = $result->fetch_assoc()) {

echo "<option value='{$row['officeid']}'>{$row['name']}</option>";




<td align="center" valign="middle">

<input type="Button" value="Add >>" style="width:100px" onClick="SelectMoveRows([url removed, login to view]['left[]'],[url removed, login to view]['right[]'])"><br><br>

<input type="Button" value="<< Remove" style="width:100px" onClick="SelectMoveRows([url removed, login to view]['right[]'],[url removed, login to view]['left[]'])"></td><td>

<select multiple style='width: 277px;' size="20" name="right[]">


<br /><br /><input type='submit' tabindex=999 value='Submit'>


Taidot: HTML, Javascript, PHP

Näytä lisää: convert a psd design to html with javascript function to select and unselect all checkboxes, jquery select multiple options drop, select multiple file time folder asp net javascript, select multiple files javascript photoshop, oscommerce select multiple options, multiple select list value retain reload javascript php, submit multiple form script java javascript, call select sql javascript function, select multiple file choose file dialog javascript, select multiple category php, joomla main_menu javascript function, multiple upload progress bar javascript php, Javascript function, cartweaver multiple product options

Projektin tunnus: #14070521

Myönnetty käyttäjälle:


Hi, i have read the project description, it’s perfectly match with my expertise. I believe i can do it with exact requirements within time and cost. I do not have any issue as i have done a lot of projects in Javascri Lisää

15 $ USD 0 päivässä
(26 arvostelua)

18 freelanceria on tarjonnut keskimäärin 17 $ tähän työhön


Hi I can do this for you. Hire me please. Thank you! .

15 $ USD 10 päivässä
(504 arvostelua)

MM. Hi, I will select all options in a select. Please let me know more about it . So that we can take things forward. Thanks.

20 $ USD 10 päivässä
(270 arvostelua)
15 $ USD 0 päivässä
(80 arvostelua)
15 $ USD 0 päivässä
(77 arvostelua)

- I'm a professional developer & designer that can work with: * PHP * HTML5 * CSS3 * jQuery * Javascript * Codeiginiter * Laravel * Bootstrap * Wordpress Themes/ Plugins. * Scrapping * UI/UX * Android and Lisää

15 $ USD 1 päivässä
(56 arvostelua)

Hello, How are you? I read your job with interest. I can do it. I’m an expert Web Developer with more than 5 years experiences on WODRPRESS(“Theme” and “Plugin”), CODEIGNITER, PHP, OOP, MYSQL, MYSQLI, JAVACSRICT Lisää

15 $ USD 0 päivässä
(36 arvostelua)

Hi, Lets discuss. I have 8 years of experience in PHP and following framework and cms i also worked on following technologies 1)Joomla 2)Wordpress 3) Smarty template engine 4) Magento 5) Drupal 6) Kohana Lisää

15 $ USD 1 päivässä
(18 arvostelua)

Please give me one chance. I am very experienced butnew in freelancing. Thanks

15 $ USD 0 päivässä
(15 arvostelua)

i got the issue lets discuss in chat looking forward for your reply start it immediately create milestone and award me i will give you solution

15 $ USD 1 päivässä
(13 arvostelua)

Dear Employer; I am professional SEO friendly website designer and developer. I have 5+ years of experience with more than 100 successful projects. I would give you multiple amendments and charge less for my high Qua Lisää

15 $ USD 0 päivässä
(25 arvostelua)

Hello, We have clearly understood your requirements and we too are willing to make some long-term clients, also we are available according to your time zone. we can do it in in hr. We have all the skills and experie Lisää

30 $ USD 1 päivässä
(9 arvostelua)

I have dedicated the last four years to website deign and development, I have extensive knowledge with a variety of applications and web languages including Adobe applications as well as in-depth expertise in CSS3, HTM Lisää

20 $ USD 10 päivässä
(2 arvostelua)

hello i am expert in my work i will show my work ping me and we will discuss bpisports.com magnilife.com newvitality.com nameb.com thanks

20 $ USD 1 päivässä
(2 arvostelua)
15 $ USD 10 päivässä
(2 arvostelua)

I would like with this letter of motivation to acknowledge you about the fact that I wanna involve in fulfilling your project. Sincerely, Ioan-Tudor Stratulat

15 $ USD 0 päivässä
(0 arvostelua)

I have vast experience of jQuey, PHP and HTML I can fix this issue in an hour. I have fixed many issues of this type

20 $ USD 1 päivässä
(0 arvostelua)

Will do it for free just for the review_____________________________________________________________

15 $ USD 10 päivässä
(0 arvostelua)