title: radio button checked when it's value is in the database?
body: <p>I have a few radio buttons on a blog I'm trying to code that are filled with categories from a database <code>categories</code>. When I edit a post with the category <code>"Fantasy"</code> I want it to be checked, but I haven't found anything that could help me.</p>
  
  <p>Here's the part of the edit.php in which I create the radio buttons:</p>
  
  <pre><code>&lt;form method="post"&gt;
   &lt;div class="categories-post-edit"&gt;
    &lt;?php foreach($categories as $cat): ?&gt;
     &lt;div class="category-post-edit"&gt;
      &lt;input type="radio" name="category" value="&lt;?php echo e($cat-&gt;id); ?&gt;"&gt;
       &lt;label&gt; &lt;?php echo e($cat-&gt;category); ?&gt;&lt;/label&gt;
      &lt;/input&gt;
     &lt;/div&gt;
    &lt;?php endforeach; ?&gt;
   &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>When the category of a post is <code>fantasy</code> I want the radio button with the label <code>fantasy</code> to be checked, but how do I achieve that?</p>