You can not pass the JavaScript variable up to PHP to index the $list array
. What you can do is to pass the whole array down to JavaScript as JSON encoded and then index into that.
See: Convert php array to Javascript
0
solved How to echo a JS variable to php? [duplicate]