I got a multidimensional array in php resulting from an sql query. I am interested how could i use my first value from the array as the name of a new variable in javascript and assign the second value from the array as the value of the newly created variable.
What i had tried it is this
foreach ($language_array as $value) {
echo "<script> var ".$value[0]." = ". $value[1]."; </script>";
}
but when i try a document.write (variable); it is that is undefined.
Array
(
[0] => Array
(
[0] => el1
[1] => Grouping
)
[1] => Array
(
[0] => el2
[1] => Type
)
[2] => Array
(
[0] => el3
[1] => Starting Date
)
[3] => Array
(
[0] => el4
[1] => Ending Date
)
[4] => Array
(
[0] => el5
[1] => Section
)
[5] => Array
(
[0] => el6
[1] => Cell
)
[6] => Array
(
[0] => el7
[1] => Client
)
[7] => Array
(
[0] => el8
[1] => Status
)
[8] => Array
(
[0] => el9
[1] => Article
)
[9] => Array
(
[0] => el10
[1] => Search
)
)
Thanks
Ervin