title: Call PHP function from an HTML table which displays a PHP Table
body: <p>I have a PHP page, which builds up a table in the php code, and then previews the table in the HTML code, like this basically:</p>
  
  <pre><code>  &lt;?php
       $display="&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"
    ?&gt;
  
    &lt;HTML&gt;
    &lt;?php echo $display; ?&gt;
    &lt;/HTML&gt;
  </code></pre>
  
  <p>Now, I need to call a function INSIDE the php script again, whenever a button is clicked. Thing is, this button is created with the php before displaying it, like this:</p>
  
  <pre><code>  &lt;?php
    function phpFunction(){ echo "Hello World"; }
  
    $display="&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;input type='button' onClick='phpFunction();'&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"
  
     ?&gt;
  
    &lt;HTML&gt;
    &lt;?php echo $display; ?&gt;
    &lt;/HTML&gt;
  </code></pre>
  
  <p>But this doesn't seem to work... Is it possible to do what I want to do here?</p>
  
  <p>If so, what's wrong in my code?</p>
  
  <p>Thanks</p>