title: PHP Delete record from database MySql
body: <p>I need to delete a record, in this case a categories from my forum, from the database based on its id.</p>
  
  <pre><code>&lt;?php
      if(isset($_SESSION['signed_in']) &amp;&amp; $_SESSION['user_level'] == 1)
      {
  ?&gt;
      &lt;td&gt;
          &lt;form method="post"&gt;
              &lt;input type="hidden" value="&lt;?= ['cat_id']; ?&gt;"&gt;
              &lt;input type="submit" name="submit" value="Remover" /&gt;
          &lt;/form&gt;
      &lt;?php
          if(isset($_POST['submit']))
          {
              mysql_query("DELETE FROM categories where cat_id = 'cat_id'");
          }
      ?&gt;
      &lt;/td&gt;
  &lt;?php
  }
  ?&gt;
  </code></pre>
  
  <p>i cant get a "good" way to do it... :(</p>
  
  <p>EDIT: This is for a programming lesson not a real forum!!</p>