Calling javascript function with php code
<p>I am trying to call the Javascript function declared at the top in my php area. However its not working. Can anyone tell me the reason for it. Everything else is working except for this part. Please help me. </p>

<pre><code>  &lt;!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;AES (Rijndael) Encryption Test in JavaScript&lt;/title&gt;
  &lt;script src="aes-enc.js" type="text/javascript" language="JavaScript"&gt;&lt;/script&gt;
  &lt;script src="aes-dec.js" type="text/javascript" language="JavaScript"&gt;&lt;/script&gt;
  &lt;script src="aes-test.js" type="text/javascript" language="JavaScript"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;

   function doDecryption()
            {
            document.write("Inside Javascript");
            var ct, key;

  ct = hex2s(&lt;?php echo $myValue; ?&gt;);
  document.write("Inside Javascript");
  document.write(ct);
 // key = hex2s(theForm.key.value);
 // theForm.plaintext.value = byteArrayToHex(rijndaelDecrypt(ct, key, "ECB"));


            }


  &lt;/script&gt;
  &lt;/head&gt;

  &lt;body&gt;
  &lt;?php
  mysql_connect("localhost","root","");
  mysql_select_db("encryption") or die(mysql_error());
  $userId = $_POST['userId'];


  if (($_SERVER['REQUEST_METHOD'] == 'POST') &amp;&amp; ($_POST['key'] == ""))
  {
     $query = mysql_query("select * from employee_details where id = '$userId'");                       if($row=mysql_fetch_assoc($query))
                {
                    echo '&lt;tr&gt;';
                    foreach($row as $value)
                    echo '&lt;td&gt;'.$value.'&lt;/td&gt;';
                    echo '&lt;/tr&gt;';
                }

            else { echo "No rows returned"; }}
    else if (($_SERVER['REQUEST_METHOD'] == 'POST') &amp;&amp; ($_POST['key']))
        {

           $columname = "ciphertext";
           $tablename = "employee_details";



                function getField($field, $tbl_name, $condition)
            {

                $result = mysql_query("SELECT $field FROM $tbl_name WHERE id =  ".$condition);

                 return @mysql_result($result, 0);
            }

                $myValue = getField($columname,$tablename,$userId);

                echo "$myValue";
                [B]echo '&lt;script type="text/javascript"&gt;
                    doDecryption();
                    &lt;/script&gt;';[/B]
                echo "whats happening";
                //doDecryption();

        }

   ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
</code></pre>
