title: Using PHP to change HTML elements
body: <p>I have a simple HTML page:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Document&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;p id="demo"&gt;Nothing here&lt;/p&gt;
      &lt;button onclick="?"&gt;Button&lt;/button&gt;       
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and a separate PHP file:</p>
  
  <pre><code>&lt;?php 
  
  // Load and exec craigslist
  $site = curl_init("https://www.craigslist.org/about/sites");
  curl_setopt($site, CURLOPT_RETURNTRANSFER, true);
  $target = curl_exec($site);
  
  $dom = new DOMDocument();
  @$dom -&gt; loadHTML($target);
  
  // Save logo text 
  $title = $dom -&gt; getElementById('logo') -&gt; nodeValue;
  
  ?&gt;
  </code></pre>
  
  <p>Here's what I want to do: </p>
  
  <p>When I click the button on the HTML page, I want the PHP script to run so that I can get the craigslist title and store it a PHP variable (<code>$title</code>). I want to replace the text in <code>&lt;p id="demo&gt;</code> ("Nothing here") with the text stored in $title ("craigslist").</p>
  
  <p>How do I do this?</p>