|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How I fill javascript array with php variables?
Hello,
I need fill javascript array with some php variables from $vyber_osoba="SELECT ID,UZIVATEL,NAZEV FROM A_PRAVA WHERE UZIVATEL='".$_SESSION['uzivatel']."' "; $vysledok_vyber_osoba = ODBC_Exec($pripojenie, $vyber_osoba ); while(ODBC_Fetch_Row($vysledok_vyber_osoba)): $meno=ODBC_Result($vysledok_vyber_osoba, "ID").ODBC_Result($vysledok_vyber_osoba, "NAZEV").ODBC_Result($vysledok_vyber_osoba, "JMENO"); endwhile; And I need put variables $meno into this array and variables must be saparate by comma var selectbox = new Array('$meno0','$meno1' .... ); for example ..... It's possible, thank you very much wiedzim |
|
#2
|
|||
|
|||
|
hi. try this code
<? $meno0 = "hello"; $meno1 = "world"; $meno2 = "dlrow"; $meno3 = "olleh"; ?> <SCRIPT LANGUAGE="JavaScript"> <!-- var arrSelectBox = new Array("<? print ($meno0); ?>","<? print ($meno1); ?>","<? print ($meno2); ?>","<? print ($meno3); ?>"); var intCtr=0; for(intCtr=0;intCtr<4;intCtr++) { document.writeln(arrSelectBox[intCtr] + "<BR>"); } //--> </SCRIPT> this might not work if this is placed in a javascript function. not sure though. good luck. |
|
#3
|
|||
|
|||
|
thanks I try and now I write back
wiedzim |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > How I fill javascript array with php variables? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|