Hi,
I'm currently having difficulties turning a javascript variable into a php variable.
This is what i have so far:

function addCustomFields(){
    var ee = document.getElementById('field_num').value;
    alert(ee);
    document.getElementById('field_list').style.display='block';
}

What do i have to add to declare a php variable so, for instance, i could call it furhter down the page like so:

<? echo $ee; ?>

Cheers

    You can't reference a javascript variable in php.

    PHP loads & runs on a web server, javascript loads & runs in a web browser. So once a webpage is loaded, php has nothing to do with it anymore. What you need to do is reload the page and send the variable to php as a POST or GET value by using a form.

      7 days later
      Write a Reply...