title: Passing PHP variable value to jquery function
body: <p>I'm new to Jquery. I have a project that has checkboxes and if their status change, then I update some sql table.</p>
  
  <p>But i decided to start with the simple things first to learn how this works...</p>
  
  <p>So, I want to pass to a Jquery function, a php variable if a checkbox status changes.</p>
  
  <p>I have this code:</p>
  
  <pre><code>&lt;?php ?&gt;
  
  &lt;HTML&gt;
   &lt;HEAD&gt;
    &lt;TITLE&gt; New Document &lt;/TITLE&gt;
    &lt;META NAME="Author" CONTENT=""&gt;
    &lt;META NAME="Keywords" CONTENT=""&gt;
    &lt;META NAME="Description" CONTENT=""&gt;
      &lt;script type="text/javascript" src="jquery-1.4.2.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        function my_function(var mensagem_id)
          {
              alert("Sucesso, Mensagem nº: " + mensagem_id);
          }
      &lt;/script&gt;
   &lt;/HEAD&gt;
  
   &lt;BODY&gt;
   &lt;?php 
      $mensagem_id = "3";
      echo $mensagem_id; 
   ?&gt;
    &lt;input type='checkbox' name='lida' value='mensagem_id' onchange='my_function($mensagem_id)'/&gt;
   &lt;/BODY&gt;
  &lt;/HTML&gt;
  </code></pre>
  
  <p>But in firebug I keep getting the message (function my_function() not defined)...</p>
  
  <p>Can anyone help me?</p>