PHP topic viewing and replying script
<p>I'm working on a small board/forum.  I have topic posting done; it's visible in the database and all that jazz.  Now I'm working on retrieving the topic list and so that when you click a topic you can view it. That's working fine, except that when I click on it the page goes blank and nothing is being shown.  I know the issue is that I can't get the id of the post I clicked on because it's in the if-else statement with a while loop.  Here is my code now.</p>

<pre><code>&lt;?php
  require('init.php');

  $get_threads = mysql_query("SELECT * FROM GOT ORDER BY time");
  if (!isset($_GET['view_thread'])) {
    $get_threads = mysql_query("SELECT * FROM GOT ORDER BY time");
    while ($select_threads = mysql_fetch_assoc($get_threads)) {
      $title = $select_threads['title'];
      $time = $select_threads['time'];
      $user = $select_threads['user'];
      $id = $select_threads['id'];
      $form = '&lt;center&gt;
               &lt;form method="get" action=""&gt;
               &lt;input type="submit" name="view_thread" id="view_thread" value="'.$title.'" /&gt;
               &lt;input type="hidden" name="thread_id" id="thread_id" value="'.$id.'" /&gt;
               &lt;/form&gt;
               &lt;/center&gt;';
      echo '&lt;div id="post_info"&gt;'.$form.'&lt;hr&gt;Posted by: &lt;b&gt;'.$user.'&lt;/b&gt; '.$time.'&lt;/div&gt;';
    }
  } else {
    $get_posts = mysql_query("SELECT * FROM GOT WHERE id='$id'");
    $select_posts = mysql_fetch_assoc($get_posts);
    $content = $select_posts['content'];
    echo $content;
  }
?&gt;
</code></pre>

<p>I need to get that <code>$id</code> so I can grab the post and later all the replies from the database. I'm new to php so I'm probably missing something. Thanks for any help!</p>
