php - Add/Remove Select Lists using jQuery - selectID not being sent in POST -


I am using code from this site:

I got the set part all set Is up, but when I submit the form, there is nothing set in $ _POST which will allow me to read the users' selection (read).

Is there a form I have established here?

  & lt; Php & lt; Form id = 'setTasks' action =' action = ae & amp; View = departmentTasks' method = 'post' & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; Td valign = 'top' & gt; & Lt; Select name = 'selectfrom' id = 'greater than one size of selectfrom =' 5 '& gt; ";; $ I & lt; $ i = 0 for counting ($ unusedTasks); $ i ++)" & lt; Option value = '"$ unusedTasks [$ i]. & Gt [' taskID '].'; '; & Lt; $ unusedTasks [$ i] ['taskName'] .. "; / Options & gt; "; Echo" & lt; / Select & gt; & Lt; / TD & gt; & Lt; Td valign = 'top' & gt; & Lt; A href = 'javascript: zero (0);' Id = 'btn-add' & gt; Add & amp; Raquo; & Lt; / A & gt; & Lt; / Td> & Lt; Td valign = 'below' & gt; & Lt; A href = 'javascript: zero (0);' Id = 'btn-remove' & gt; & Amp; Laquo; Remove & lt; / A & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; Select name = 'selectto' id = 'more than one size of selectto =' 5 '& gt; "; $ I & lt; Count ($ departmentsTasks); $ i ++ $ i = 0) for echo" & lt; Option value = "" $ departmentTasks [$ i]. "['TaskID']. ';'; & Lt "$ departmentTasks [$ i] ['taskName'] .."; / Options & gt; "; Echo" & lt; / Select & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; Input type = 'hidden' name = 'departmentID' value = '". $ DepartmentID."' / / Gt; & Lt; Input type = 'hidden' name = 'submit' value = '1' / & gt; & Lt; Input type = 'submit' name = 'submitForm' value = 'assign job' / & gt; & Amp; Nbsp; & Amp; Nbsp; & Lt; Input type = 'button' value = 'cancel' onclick = 'javascript: history.go (-1);' / & Gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Form & gt; ";; & Gt;   

and function:

  $ (document) .ready (function () {$ ('# append (" & lt ; Option value = '(FTP) "$ (This) .val () +"'> "+ $ (this) .text () +" & lt; / option & gt; "); $ (this) Click ($ ('(# select-to options: selected'). (Function () {$ ('#' ($ ('# btn-remove' Select-from '). Append ("& lt; option value =' '+ $ (this) .val () +"'> "+ $ (this) .text () +" & lt; / option & Gt; "); $ (this) .remove ();}););});   

The front end (moving the objects back) works fine, but when I do var_dump ($ _ POST) select the field I do not get any information. Anyone who is missing me, is able to see anyone?

You do not get any form data because selection lists only selected items Sends.

One solution: Loop through all the options and set them as selected before posting.

Another solution: Before copying you need information in a secret field from the option.

Comments