0

I am trying to use a global variable from this code in javascript:

function myFunction(X) 
            {
                    index = X.selectedIndex ;
                    alert(X.options[index].value) ;

            }

to this other file in the same project but in php:

function Trier(){

    $eleve = new Eleve();
    $matiere = new Matiere();
    $examen = new Examen();

    if($_GET['classe'] == "Tous" && $_GET['exam'] == "Aucun"){
        listEleveGlobal();  
}

the final objectif is to replace $_GET['classe'] by the variable 'y' thinks!

Fawzan
  • 4,738
  • 8
  • 41
  • 85
lharry
  • 135
  • 1
  • 3
  • 16
  • 1
    possible duplicate of [How to pass JavaScript variables to PHP?](http://stackoverflow.com/questions/1917576/how-to-pass-javascript-variables-to-php) – depperm Jun 23 '15 at 11:08
  • Using AJAX functionality, its is possible – Karthik Keyan Jun 23 '15 at 11:18
  • Thinks for the answer but i have no idea how to use AJAX. i have made some researches and don't really see how to start! – lharry Jun 23 '15 at 11:26
  • I'm not entirely sure of your question, but if you just want to use the variable in your JS function in your PHP function, this is not possible as explained in the duplicate linked by @depperm – Ciaran Jun 23 '15 at 11:50
  • this is what i'm trying to do. i've got combo list that i would like to refresh the page with the selected option. i am using ' onchange ' for that.`     ` – lharry Jun 23 '15 at 12:00

0 Answers0