Open Message when clicked table field

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Nimaro
Forum Newbie
Posts: 19
Joined: Thu Nov 19, 2009 11:26 am

Open Message when clicked table field

Post by Nimaro »

Hy everyone,
I have 1 table that represents the messages that 1 certain doctor have. What im trying to do is when the doctor click on 1 message of the table, the text on that message happears in the right side of the table.
Im going to post here the code i have for now....

Code: Select all

<!----------------PESQUISA POR Medico---------->
 <?php
 if(isset($_POST['submit']))
 {
     $id_medico = strip_tags($_POST['id_medico']);
     $exc = "SHOW TABLES"; /*VARIÁVEL RENOMEADA*/
     $query = mysql_query("SELECT * FROM mensagens WHERE id_medico = '".mysql_real_escape_string($id_medico)."'");
 ?>
 <div id="topic">
     <b>Tabelas da base de dados</b>
 </div>
 <table id="content" border="2" bordercolor="#00CC00">
 <tr>
    <th>id_utilizador</th>
    <th>mensagem</th>
    <th>data</th>
    <th>hora</th>
 </tr>
 <?php
     while($dados = mysql_fetch_array($query)){
 ?>
     <tr>
      <td>| <?php echo $dados[1]; ?></td>
      <td><a href="ler_mensagens.php?id=<?php echo $dados['id']; ?>" target="_blank"><?php echo $dados[4]; ?></a></td>
      <td>| <?php echo $dados[6]; ?></td>
      <td>| <?php echo $dados[7]; ?></td>
     </tr>
 <?php } ?>
 </table>
 <?php
 } else $nome = '';
 ?>
Im opening ler_mensagens.php when the field is clicked, but i think i need is to run a script that would put the message on the right side of the table.
I hope u understand what i mean, and that u can help me on the best way i can have to do this.
Post Reply