Table within tabs. Rules

Asked

Viewed 247 times

1

I’m having trouble putting a table inside tabs. The data is all inside except the tables.

  echo'<div id="tabs-1">


      <p><b>Alvará: </b></p>';
        echo '<table width=500>
        <tr>
        <td><b>Número</b></td>
        <td><b>Validade</b></td>
        <td><b>Anexo</b></td>
        </tr>';
        echo "<td>".$exibe['AlvaraNumero']."</td>";
        if ($exibe['AlvaraValidade']) { 
        if (strtotime($exibe['AlvaraValidade']) < time())  {
        echo "<tr>";
        echo " <td>'<span style='color:red'>".$exibe['AlvaraValidade']."</span>'</td>";
        }else{
        echo " <td>".$exibe['AlvaraValidade']."</td>";
        }
        echo "<td><a href='MostrarAlvara.php?id=".$exibe['id']."'>Ver PDF </a></td>";
        echo "</tr>";
        }
        echo '</table>';
 '</p>
 </div>';

inserir a descrição da imagem aqui

3 answers

2

Try the code below. I checked some closing errors in ELSE and quotation marks.

echo'<p><b>Alvará: </b></p>';
echo '<table>
<tr>
<td>Número</td>
<td>Validade</td>
<td>Anexo</td>
</tr>';
if ($exibe['AlvaraValidade']) { 
    if (strtotime($exibe['AlvaraValidade']) < time())  {
        echo "<tr>";
        echo " <td>'<span style='color:red'>".$exibe['AlvaraValidade']."</span>'</td>";
    } else {
        echo " <td>".$exibe['AlvaraValidade']."</td>";
    }
    echo "</tr>";
}
if($exibe['Nome2'] != NULL) {
    echo "<tr>
    <td>{$exibe['Nome2']}</td>
    <td>{$exibe['Funcao2']}</td>
    </tr>";
}
echo '</table>';
  • Alisson, put two answers. You can remove one of them and explain your answer better. (And welcome to Stackoverflow!)

  • Just one question. How can I put a link to open in an echo? echo "<td>'<a href="Displayalvara.php? id=' . $displays['id'] . '">View PDF '</a></td>"

2


To make a link within a echo is simple:

echo '<a href="MostrarAlvara.php?id='.$exibe["id"] .'">Ver PDF</a>';

Always close the quotes you opened, so there is no error in your code.

  • I changed the code that showed the table and I continue with the error of the table being outside the </div>

-1

Try to use this code with the modifications I made.

http://pastebin.com/cJ2XZB4F

<?php
    echo '<div id="tabs-1">';
    echo '<img align="right" src="logos/'.$exibe["Nome"].'.jpg">';
    echo '<p>Nome:<b>'.$exibe["Nome"].'</b></p>';
    echo '<p>Morada:   '.$exibe["Morada"].'</p>';
    echo '<p>Distrito: '.$exibe["Distrito"].'</p>';
    echo '<p>Concelho: '.$exibe["Concelho"].'</p>';
    echo '<p>Tipo: '.$exibe["Tipo"].'</p>';
    echo '<div align="right"> <p>Avaliação: '.$exibe["Avaliacao"].'</p> </div>';
    echo '<p>Email: '.$exibe["Email"].'</p>';
    echo '<p>Organograma: <a href="MostrarOrganograma.php?id='.$exibe['id'] . '">
        Ver Organograma </a></p>';
    echo'<p><b>Alvará: </b></p>';
    echo '<table border="0">';  
    echo '<tr><td>Número</td><td>Validade</td><td>Anexo</td></tr>';
    echo "<tr><td>".$exibe['AlvaraNumero']."</td></tr>";
    if ($exibe['AlvaraValidade']) {
        if (strtotime($exibe['AlvaraValidade']) < time())  {
          echo "<tr><td>'<span style='color:red'>".$exibe['AlvaraValidade']."</span>'</td>";
        } else {
          echo " <td>".$exibe['AlvaraValidade']."</td>";
        }
        echo "<td><a href='MostrarAlvara.php?id=".$exibe['id']."'>Ver PDF </a></td></tr>";
    }
    echo '</table>';
    echo '</div>';
?>
  • I still have the same problem. In the table zone it is in a different place

Browser other questions tagged

You are not signed in. Login or sign up in order to post.