1

im using SMARTY and php4. (cant upgrade...)

i have two selects where i move contet which i get from database from one select to the other with buttons like this : |<<| |>>| using jquery. Now my problem is submitting everything which is in the right select.

code im using so far to submit my right select. (select1 = left) (select2 = right)

function submitForm()
{

   $('form').submit(function() {  
    $('#select2 option').each(function(i) {  
        $(this).attr("selected", "selected");  
            });  
        }); 
}

My right select:

<form  method="POST" name="arbeitsplatz_werte">

   <select style="width:285px;" id='select2' name='select2'  size="20" multiple class='fr'>
      {foreach item=tef4 from=$tef4_button_inhalte}    
         {html_options title=$tef4.VCARBPLATZ selected=$smarty.post.VCARBPLATZ values=$tef4.VCARBPLATZ output=$tef4.VCARBPLATZ|cat:" "|cat:$tef4.VCBEZEICHNUNG}
      {/foreach}
   </select>
</form>

in php:

$select_post = $_POST['select2'];

Now the problem is, when submitting, i only get the last row of my select2 content AND instead saving each row how intended like this

$select_post[0] = {W840-PG}
$select_post[1] = {W840-SN}
$select_post[2] = {W840-SZ}
$select_post[3] = {W840-VM}
             .
             .
             .

it saves only the last row like this

$select_post[0] = {W}
$select_post[1] = {8}
$select_post[2] = {4}
$select_post[3] = {0}
$select_post[3] = {-}
$select_post[3] = {V}
$select_post[3] = {M}

generated select1 :

 <div style="overflow:auto;"><select style="width:285px;" id='select1' name='select1' size="20" multiple class='fl'>

    <option label="T4-100 TEF4-TS Gruppenleiter " value="T4-100">T4-100 TEF4-TS Gruppenleiter </option>
    <option label="T4-101 TEF4-TS Fachgruppenleiter " value="T4-101">T4-101 TEF4-TS Fachgruppenleiter </option>
    <option label="T4-102 TEF4-TPM Fachteamleiter " value="T4-102">T4-102 TEF4-TPM Fachteamleiter </option>
    <option label="T4-103 TEF4-TS Fachteamleiter Mechanik Im " value="T4-103">T4-103 TEF4-TS Fachteamleiter Mechanik Im </option>

</select></div>             

generated select2:

<div><select style="width:285px;" id='select2' name='select2'  size="20" multiple class='fr'>

  <option label="W840-PG W840-Phasengeber instands. Gr.59 Treppte" value="W840-PG">W840-PG W840-Phasengeber instands. Gr.59 Treppte</option>
  <option label="W840-SN W840-Stanzen WZ-Instands. Gr.20 Eller" value="W840-SN">W840-SN W840-Stanzen WZ-Instands. Gr.20 Eller</option>
  <option label="W840-SZ W840-Spritzen WZ-Instands. Gr.60 Porkert" value="W840-SZ">W840-SZ W840-Spritzen WZ-Instands. Gr.60 Porkert</option>
  <option label="W840-VM W840-Messen - Gruppe 99 Rist" value="W840-VM">W840-VM W840-Messen - Gruppe 99 Rist</option>

</select></div>

someone knows where im screwing up ? :X

DavidG
  • 113,891
  • 12
  • 217
  • 223

1 Answers1

1

Problem solved..

the name of the select2 should be "select2[]"! like this he submits an array..

<select style="width:285px;" id='select2' name='select2[]'  size="20" multiple class='fr'>