title: Replace code in tab on click
body: <p>i need a little help with one of the sections of my website which involves private messages. The page in question has 4 tabs on it, one of the tabs called inbox displays a table of all the messages received, the subject of each message has a link which can go to another page displaying the message in greater detail. However what i want is for the content in the inbox tab to be replaced by the code for displaying the message in more detail.</p>
  
  <p>Here is the code for the inbox table</p>
  
  <pre><code>&lt;div id="inbox" class="tab_content"&gt;
      &lt;table id="mail_header"&gt;
  
                &lt;tr class="mailHeader"&gt;
                  &lt;th&gt;Message ID&lt;/th&gt;
                  &lt;th&gt;From&lt;/th&gt;
                  &lt;th&gt;Subject&lt;/th&gt;
                  &lt;th&gt;Content&lt;/th&gt;
                  &lt;!--&lt;th&gt;Date Completed&lt;/th&gt;--&gt;
                  &lt;th&gt;Date Sent&lt;/th&gt;
                  &lt;!--&lt;th&gt;Refused&lt;/th&gt;--&gt;
  
                  &lt;/tr&gt;
                          &lt;?php
                          $sql = mysql_query("SELECT * FROM user_message WHERE id=$id");
                          $rowCheck = mysql_num_rows($sql);
                          if ($rowCheck == 0) {
                             echo "You Have No Messages";
                             die;
                          }
                          else {
                             while ($query = mysql_fetch_array($sql)) {
                                      echo '&lt;div id="message_content"&gt;';
                                    echo '&lt;tr&gt;';
                                    $message_id = $query['message'];
                                    $from = $query['from'];
                                    $subject = $query['subject'];
                                    $message_content = $query['message_content'];
                                    $date_sent = $query['date_sent'];
                                    $viewed = $query['viewed'];
                                    if($viewed == '0'){
                                      echo "&lt;td&gt;&lt;boldMail&gt;$message_id&lt;/boldMail&gt;&lt;/td&gt;";
                                      echo "&lt;td&gt;&lt;boldMail&gt;$from&lt;/boldMail&gt;&lt;/td&gt;";
                                      echo "&lt;td&gt;&lt;boldMailSubject&gt;&lt;a href='mail.php?mail=$message_id'&gt;$subject&lt;/a&gt;&lt;/boldMail&gt;&lt;/td&gt;";
                                      echo "&lt;td&gt;&lt;boldMail&gt;&lt;div&gt;$message_content&lt;/div&gt;&lt;/boldMail&gt;&lt;/td&gt;";
                                      echo "&lt;td&gt;&lt;boldMail&gt;$date_sent&lt;/boldMail&gt;&lt;/td&gt;";
                                    }
                                    else{
                                      echo "&lt;td&gt;$message_id&lt;/td&gt;";  
                                      echo "&lt;td&gt;$from&lt;/td&gt;";
                                      echo "&lt;td&gt;&lt;a href='mail.php?mail=$message_id'&gt;$subject&lt;/a&gt;&lt;/td&gt;";
                                      echo "&lt;td&gt;&lt;div&gt;$message_content&lt;/div&gt;&lt;/td&gt;";
                                      echo "&lt;td&gt;$date_sent&lt;/td&gt;";
                                    }
  
  
                                    echo '&lt;/tr&gt;';
                                    echo '&lt;/div&gt;';
                             }
                          }
                          ?&gt;
                  &lt;/table&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is the code i want to replace the above code on clicking one of the messages</p>
  
  <pre><code>&lt;?php
          $mail_id = "";
          $mail_id = $_GET['mail'];
          if($mail_id = ""){
              $string = get_include_contents('mailContent.php');
              echo "$string";
          }
          else{
  
              $mail_id = "";
              $mail_id = $_GET['mail'];
  
              $sql_mail = mysql_query("SELECT * FROM user_message WHERE message='$mail_id'");
              $mail_array = mysql_fetch_assoc($sql_mail);
  
              $message_id = $mail_array['message'];
              $from = $mail_array['from'];
              $subject = $mail_array['subject'];
              $message_content = $mail_array['message_content'];
              $date_sent = $mail_array['date_sent'];
  
              echo "$message_id";
              echo "$from";
              echo "$subject";
              echo "$message_content";
              echo "$date_sent";
  
          }
          ?&gt;
  </code></pre>
  
  <p>Thanks for your ideas, even if you can tell me if i need actionscript or javascript etc... i would appreciate it.</p>