Help with PHP and HTML

Asked

Viewed 66 times

0

I am learning php and html and would like some help if possible, of course. I am creating a table according to some variables passed as parameter and when it is created !

inserir a descrição da imagem aqui

I would like to remove these spaces to each column that is being presented in white. Someone knows how to resolve. Thanks in advance My code is messed up, I confess, because I’m still learning, but it follows:

<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"> 
</script>
</head>
<body>
<div class="container">

 <?php header("Content-type: text/html; charset=utf-8");
 include_once("BDdados.php");
 $idSetorSelecionado = $_POST['setor'];
 $idCompentenciaSelecionado = $_POST['competencia'];
 $qtdeDeRegistro = $_POST['funcionarios'];

 echo "O setor selecionado no combobox foi " . $idSetorSelecionado . "<br>";
 echo "A competencia selecionado no combobox foi " . 
 $idCompentenciaSelecionado . "<br>";
 echo "O numero de funcionarios e " . $qtdeDeRegistro . "<br>";

 $strcon = mysqli_connect($servidor,$usuario,$senha,$banco);
 mysqli_set_charset($strcon, 'utf8'); // Configurar a conexão para usar 
 codificação UTF-8

 if (!$strcon) {
 die('Não foi possível conectar ao MySQL');
 }
 $sqlLookCompetencia = "SELECT nome, qtd_dias FROM competencia WHERE 
 id='$idCompentenciaSelecionado'";
 $resultadoLookCompetencia = mysqli_query($strcon,$sqlLookCompetencia) or 
 die(mysql_error()."<br>Erro ao executar a inserção dos dados");
 $elemento = mysqli_fetch_array($resultadoLookCompetencia);
 $qtdeDeDias = $elemento['qtd_dias'];

$x = 1;
$y = 1; 
echo"<table class='table table-bordered'>";
echo"<thead><tr><td></td><td></td><td></td><td></td><td colspan='2'>HORÁRIO</td><td colspan='2'>HORÁRIO INTRAJORNADA</td></tr></thead>";
echo"<tbody>";
echo"<tr>";
echo"<th scope='col'>MATRÍCULA<th>";
echo"<th scope='col'>NOME COMPLETO<th>";
echo"<th scope='col'>NOME E Nº CONSELHO<th>";
echo"<th scope='col'>SETOR DE LOTAÇÃO<th>";
echo"<th scope='col'>ENTRADA<th>";
echo"<th scope='col'>SAÍDA<th>";
echo"<th scope='col'>ENTRADA<th>";
echo"<th scope='col'>SAÍDA<th>";
while($x <= $qtdeDeDias) {
    echo"<th scope='col'>".$x."<th>";
$x++;
} 
$x = 1;
echo "</tr>";

while($y <= $qtdeDeRegistro) {
    echo"<tr>";
    echo"<th><th>";
    echo"<th><th>";
    echo"<th><th>";
    echo"<th><th>";
    echo"<th><th>";
    echo"<th><th>";
    echo"<th><th>";
    echo"<th><th>";
    while($x <= $qtdeDeDias) {
        echo"<th><th>";
        $x++;
    } 
    $y++;
    $x = 1;
} 
echo"</tr>";
echo"</tbody>";
echo"</table>";


?>
</div>

</body>
</html>

1 answer

1

Buddy, check the tag <th>, 'cause you’re not closing it, for example, the line:

echo "<th scope='col'>MATRÍCULA<th>

Notice that you didn’t close the tag, just close it:

echo "<th scope='col'>MATRÍCULA</th>

Revise your tags <tr> <td> and <th> and see if it is being closed after opening them.

Browser other questions tagged

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