Why is the variable undefined in this code? - PHP
<p>I have these codes:</p>

<p><code>testing.php</code></p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;
        function copy_data(id){
            var a = document.getElementById(id).value;
            document.getElementById("copy_to").value=a;
        }
    &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form action="testprocess.php" method="post"&gt;
&lt;input type="text" name ="a" id="copy_from" onkeyup="copy_data('copy_from')"/&gt;
&lt;input type="text" value=0 name ="b" id="copy_to"/&gt;
&lt;input type="submit"&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p><code>testprocess.php</code></p>

<pre><code>&lt;?php

    $test = $_POST['copy_to'];

    echo $test;
?&gt;
</code></pre>

<p>I get an error saying that <code>'copy-to'</code> is an undefined variable. Can you please tell me why?
Thanks. </p>
