title: Radio button value not "checked" in edit form
body: <p>I have a table with the option edit on each row. When I click on edit, a form pops up and shows the fields filled out with the data to edit. However the selected radio button is not showing.<br>
  Can you tell what is missing in my code? Like how can I make the correct radio button show the checked value? </p>
  
  <p><strong>Here is the edit form:</strong></p>
  
  <pre><code>&lt;form action="edit_movie.php" method="post"&gt;
  &lt;input type="hidden" name="id" value="&lt;?php echo $movie['id']; ?&gt;" /&gt; &lt;br&gt;
  Title:&lt;br&gt; &lt;input type="text" name="title" value="&lt;?php echo $movie['title']; ?&gt;" /&gt; &lt;br&gt;
  Release Year:&lt;br&gt; &lt;input type="text" name="release_year" value="&lt;?php echo $movie['release_year']; ?&gt;" /&gt; &lt;br&gt;
  Director:&lt;br&gt; &lt;input type="text" name="director" value="&lt;?php echo $movie['director']; ?&gt;" /&gt; &lt;br&gt;&lt;br&gt;
  Select genre:
  &lt;br&gt; &lt;input type="radio" name="genre_id" value="1"&lt;?php if($movie['genre'] == 1) { echo ' checked'; } ?&gt; /&gt;Action&lt;br&gt;
  &lt;br&gt; &lt;input type="radio" name="genre_id" value="2"&lt;?php if($movie['genre'] == 2) { echo ' checked'; } ?&gt; /&gt;Comedy&lt;br&gt;
  &lt;br&gt; &lt;input type="radio" name="genre_id" value="3"&lt;?php if($movie['genre'] == 3) { echo ' checked'; } ?&gt; /&gt;Drama&lt;br&gt;
  &lt;br&gt; &lt;input type="radio" name="genre_id" value="4"&lt;?php if($movie['genre'] == 4) { echo ' checked'; } ?&gt; /&gt;Horror&lt;br&gt;
  &lt;br&gt; &lt;input type="radio" name="genre_id" value="5"&lt;?php if($movie['genre'] == 5) { echo ' checked'; } ?&gt; /&gt;Romance&lt;br&gt;
  &lt;br&gt; &lt;input type="radio" name="genre_id" value="6"&lt;?php if($movie['genre'] == 6) { echo ' checked'; } ?&gt; /&gt;Thriller&lt;br&gt;
  &lt;input type="submit" value="Update movie" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>And here is the code for the edit:</strong></p>
  
  <pre><code>function get_movie_by_id($id){
  
     $query = sprintf("SELECT * FROM movies m INNER JOIN categories c ON m.genre_id = c.genre_id WHERE id = '%s' LIMIT 1", mysql_real_escape_string($id));
  
     $result = mysql_query($query);
  
     if ( ! $result ){
         return false;
     } else {
           $return = array();
  
           while ($row = mysql_fetch_assoc($result)){
  
                  $return = array('director' =&gt; $row['director'], 'genre' =&gt; $row['genre'], 'release_year' =&gt; $row['release_year'], 'title' =&gt; $row['title'], 'id' =&gt; $row['id']); 
           }
               return $return;
       }
  }
  
  
  
  if ( isset($_GET['edit']) ){
  
     $movie = get_movie_by_id($_GET['edit']);
  }
  </code></pre>