How to get the 2 value of an index and show?

1

In my program I search the table data and add it to a array v_patr and then I add that array to var w_a :

<html>
            <select multiple size="7" name="cb_Patr" style="width:300">
                <?
                $w_querybusca="SELECT * FROM public.sai_cad_patr_seri WHERE 
                                sai_cad_patr_seri.fk_seq_cara_peri = '$arr_w_param[17]'";     
                $w_queryresultado=f_class_conecta_bd($w_querybusca);            
                $w_indice = 0;
                while($w_registro = pg_fetch_object($w_queryresultado))
                {
                    print('<option value="'.$w_registro->tx_num_patr.'">'.trim($w_registro->tx_num_patr).'</option>'."\n");

                    print("<SCRIPT language=javascript>  
                               v_patr[$w_indice] = \"$w_registro->tx_num_patr,$w_registro->tx_num_seri\";
                           w_a = v_patr[$w_indice];
                           </SCRIPT>"); 

                    $w_indice++;
                }
                ?>
               </select>    

But I have a second survey later. So I'm going to reuse the v_patr that was added in w_a to get element 1 from the array.

            <select multiple size="7" name="cb_Seri" style="width:300"> 
            <?
                for($i=0;$i<=$w_indice;$i++)
                {   

                    //print('<option value="'.$i.'">'._[$i].'</option>'."\n");
                }
                ?>
                </select>

But I do not know how to get the elements of w_a that was created in a JS inside the php and assign it to: print('<option value="'.$i.'">'.w_a[$i].'</option>'."\n");

    
asked by anonymous 08.10.2014 / 18:49

1 answer

1

The transport of the variable from one language to another must be done on a new request. Not only will it bother you to try to traffic this information about both languages, as this is the wrong way to do it.

In order not to reinvent the wheel, I suggest you read this mine answer which gives a summary about requests $.ajax - which is the solution to your problems.

    
08.10.2014 / 18:53