How can I use a JavaScript variable as a PHP variable?
<p>I'm trying to include JavaScript variables into PHP code as PHP variables, but I'm having problems doing so. When a button is clicked, the following function is called:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    function addTraining(leve, name, date)
    {
        var level_var = document.getElementById(leve);
        var training_name_var = document.getElementById(name);
        var training_date_var = document.getElementById(date);

        &lt;?php
            $result = "INSERT INTO training(level, school_name, training_date) VALUES('level_var', 'training_name_var', 'training_date_var')" or die("Query not possible.");
        ?&gt;

&lt;/script&gt;
</code></pre>

<p>How can this problem be fixed?</p>
