title: MySql. After HTML button is clicked - TRUNCATE database table
body: <p>So I need simple thing, I need to create button in my website, after button is clicked, It should truncate database table, but I can't do It successfully by myself. So could you help me, please?</p>
  
  <p>Here I'm trying to creeate button:</p>
  
  <pre><code>&lt;input type="button" id='delete' class='delete' value='Truncate' onClick="$truncate"&gt;
  &lt;/input&gt;
  </code></pre>
  
  <p>I know this is wrong way to use PHP variable in HTML, but I don't know how to do It correctly.</p>
  
  <p>Here is my PHP variable: </p>
  
  <p><code>$truncate= "TRUNCATE TABLE myTable";</code></p>
  
  <p>With connection to database is all right: </p>
  
  <p><code>$mysqli = new mysqli("localhost","database","password","asd");</code></p>
  
  <p>So maybe here is better method to create button for truncate database's table? Thank you.</p>
  
  <p><strong>UPDATED:</strong></p>
  
  <p>This won't work too, nothing happens after button is clicked.</p>
  
  <pre><code>    if(isset($_POST['delete'])){
      $delete= "TRUNCATE TABLE myTable";
      }
  ?&gt;
  &lt;input type="button" id='delete' class='delete' name="delete" value='Truncate' onClick="delete"&gt;
  &lt;/input&gt;
  </code></pre>