Pass variable (to Ajax) that results from Js function but PHP gets it as 'NULL'
<p>This function correctly checks if the iput string is already in use by comparing it to data picked up by PHP from the databese. My problem is that when I pass this variable via Ajax it returns 'NULL' but when I pass other variables they are sent correctly, so the ajax function is working. Maybe something in my function is to blame?</p>

<pre><code>var string, code, codUp, result;
function check(){
      string="&lt;?php echo $html; ?&gt;";
      code = document.getElementById('this_code').value;
      codUp = code.toUpperCase();
      result=string.split(" ");      

if (document.getElementById('this_code').value === "")
{
    return false;
}
else if (result.indexOf(codUp) === -1)
{
    return false;
}
else{alert ('Code already in use.');}
};
</code></pre>

<p>AJAX</p>

<pre><code>ajax.open('GET','agencies/gen_ag.php?action=add&amp;name='+name+'codeUp='+codUp'&amp;nocomp='+nocompt_ag,true);
</code></pre>

<p>PHP</p>

<pre><code>if($_GET['action']=='add')  {
$res_seecode = mysql_query("SELECT * FROM agencies WHERE EMP_CODE = '$_GET[code]'");
if(!mysql_num_rows($res_seecode))   {
    $res_add = mysql_query("INSERT INTO agencies VALUES      ('NULL','$_GET[codUp]','$_GET[name]'");

            echo 'Agencie created.';
}
</code></pre>

<p><code>Var_dump();</code> Returns name but not codUp.</p>
