title: Passing a PHP variable as a parameter using HTML onClick
body: <p>I looked through many similar examples, but I could not make this work.</p>
  
  <p>So, I have this:</p>
  
  <pre><code>echo('&lt;td colspan="3" style="background-color:#005673; text-align:right; padding: 4px 0px;"&gt;
        &lt;button class="btnTrack" onClick="trackIt(' . $name . ')" &gt;Track It!&lt;/button&gt;&lt;/td&gt;');
  </code></pre>
  
  <p>That code is inside a for, so the variable $name will be different depending where I am at.</p>
  
  <p>I am not trying to make things complicates, so first, I am just trying to pass that parameter to the function trackIt (I actually need to pass 2 of them.)</p>
  
  <p>Then, I have a simple script (just to see if it will work):</p>
  
  <pre><code>&lt;script&gt;
  //After you click on Track It
  
  function trackIt(param) 
  {
     alert("Hi!");
     alert(param);
  }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>However, it does not work.</p>
  
  <p>If my <code>onClick</code> function is just <code>onClick="trackIt()"</code>, then it works fine and I can alert "Hi!" by removing the parameter. </p>
  
  <p>Thanks for the help! =]</p>