Динамическая таблица PHP / HTML - PullRequest
0 голосов
/ 03 декабря 2018

Я знаю, что это может быть глупый вопрос, но я хотел бы понять, почему он входит в третий <tr>, где размещается метка и кнопка автоматически переходит в заголовок ...

Я уже пытался изменить длину / высоту, но это не работает -.- Мне нужно, чтобы кнопка и метка были в одном ряду, без переноса

enter image description here

<!DOCTYPE html>
<?php
session_start();
if (!isset($_SESSION["username"])) {
    header('location: ../index.php');
} else {
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "my_progettocantiere";

$idCantiere = $_GET["idCantiere"];
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT idCantiere,nomeCantiere,codiceCommessa,indirizzoCantiere FROM Cantiere WHERE idCantiere = '$idCantiere'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while ($row = $result->fetch_assoc()) {

        echo '<h1 align="center">' . $row["codiceCommessa"] . ' - ' . $row["nomeCantiere"] . '</h1>';
    }

} else {
    echo "0 results";
}
$conn1 = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn1->connect_error) {
    die("Connection failed: " . $conn1->connect_error);
}

$sql1 = "SELECT * FROM Affidataria WHERE fkIDCantiere = '$idCantiere'";
$result1 = $conn1->query($sql1);

echo '<table align="center" border="3px" width = "1300px">';
echo '<tr align="center">';
echo '<td bgcolor="#FF0000"width=750px" ><h1>Anagrafica</h1>';
echo '<td><a class="myButton" href="../../pagineHtml/visualizza/visualizzazione/inserimentoCantiere.php?idCantiere=' . $row1["idCantiere"] . '">Anagrafica</a></td>';
echo '</tr>';
echo '</table>';
//echo "<script type='text/javascript'>alert('$idAffidataria');</script>";
if ($result1->num_rows > 0) {
    // output data of each row
    while ($row1 = $result1->fetch_assoc()) {
        echo '<table align="center" border="3px" width = "1300px">';
        echo '<tr align="center">';
        echo '<td bgcolor="#FF0000" height="80px"><h1> </h1></td>';
        echo '<td bgcolor="#FF0000"><h1> </h1></td></tr>';

        echo '<tr><td width=750px" align="center"><h1>' . $row1["tipologiaAffidataria"] . '</h1><a class="myButton" href="../../pagineHtml/visualizza/visualizzazione/affidatario.php?idAffidataria=' . $row1["idAffidataria"] . '">' . $row1["nomeCantiere"] . '</a> </td>';

        echo '<td align="center"><a class="myButton" href="../../paginaIniziale/azioniVisualizza/SceltaSubAffidatario.php?idAffidataria=' . $row1["idAffidataria"] . '">Vai a SubAffidatario</a></td>';
        echo '</tr>';
        echo '</table>';
    }
} else {
    echo "0 results";
}
$conn->close();
$conn1->close();
//$conn2->close();
?>

<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http - equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title> Progetto Cantiere </title>
    <!--Bootstrap -->
    <link href="../paginaIniziale/css/bootstrap-4.0.0.css" rel="stylesheet">
</head>
<style>
    .myButton {
        -moz -box
        -shadow: inset 0px 1px 0px 0px #97c4fe;
        -webkit -box
        -shadow: inset 0px 1px 0px 0px #97c4fe;
        box -shadow: inset 0px 1px 0px 0px #97c4fe;
        background: -webkit -gradient(linear, left top, left bottom, color -stop(0.05, #3d94f6), color-stop(1, #1e62d0));
        background: -moz -linear -gradient(top, #3d94f6 5%, #1e62d0 100%);
        background: -webkit -linear -gradient(top, #3d94f6 5%, #1e62d0 100%);
        background: -o -linear -gradient(top, #3d94f6 5%, #1e62d0 100%);
        background: -ms -linear -gradient(top, #3d94f6 5%, #1e62d0 100%);
        background: linear -gradient(to bottom, #3d94f6 5%, #1e62d0 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3d94f6', endColorstr='#1e62d0', GradientType=0);
        background -color: #3d94f6;
        -moz -border
        -radius: 6px;
        -webkit -border
        -radius: 6px;
        border -radius: 6px;
        border: 1px solid #0f73ff;
        display: inline -block;
        cursor: pointer;
        color: #ffffff;
        font -family: Arial;
        font -size: 28px;
        font -weight: bold;
        padding: 32px 76px;
        text -decoration: none;
        text -shadow: 0px 1px 0px #1570cd;
    }

    .myButton:hover {
        background: -webkit -gradient(linear, left top, left bottom, color -stop(0.05, #1e62d0), color-stop(1, #3d94f6));
        background: -moz -linear -gradient(top, #1e62d0 5%, #3d94f6 100%);
        background: -webkit -linear -gradient(top, #1e62d0 5%, #3d94f6 100%);
        background: -o -linear -gradient(top, #1e62d0 5%, #3d94f6 100%);
        background: -ms -linear -gradient(top, #1e62d0 5%, #3d94f6 100%);
        background: linear -gradient(to bottom, #1e62d0 5%, #3d94f6 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#1e62d0', endColorstr='#3d94f6', GradientType=0);
        background -color: #1e62d0;
    }

    .myButton:active {
        position: relative;
        top: 1px;
    }

</style>
<body>
<table align="center">
    <tr>
        <td style=" border-style: none;"></td>
        <td style=" border-style: none;" align="center" colspan="19">
            <img src="../../../login/images/logo.jpg" width="300px" align="center" height="100px" alt="Logo SALC.SPA"></td>
    </tr>
</table>
</body>
</html>
<?php } ?>

Проблема в этой строке:

echo '<tr><td width=750px" align="center"><h1>' . $row1["tipologiaAffidataria"]
    . '</h1><a class="myButton" href="../../pagineHtml/visualizza/visualizzazione/affidatario.php?idAffidataria='
    . $row1["idAffidataria"] . '">' . $row1["nomeCantiere"] . '</a> </td>';
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...