title: Using php to create a button that calls a php function
body: <p>Currently I have the following but it doesn't like me very much:<br>
  1. index.php:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;div id = "bookList"&gt;
      &lt;?php
      include("list.php");
      ?&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>2. list.php:</p>
  
  <pre><code>&lt;?php
  echo '&lt;button id = "read"&gt;Read&lt;/button&gt;&lt;br&gt;&lt;br&gt;';
  echo 
  "&lt;script type=\"text/javascript\"&gt;
  $(\"#read\").click(function()
  {
  alert(\"&lt;?php display(); ?&gt;\");
  });
  &lt;/script&gt;";
  
  function display()
  {
      echo "hello";
  }
  ?&gt;
  </code></pre>
  
  <p>As is hopefully obvious from the code I posted above, I am attempting to create a button using php which when clicked on will in turn call a php function. I have not been successful as of yet. Any advice will be appreciated but I'd like my code to stay as close to what I currently have as possible.</p>