1

訪問者が情報を入力できるフォームがあり、バックエンドで、クライアントが表示できるようにこの情報を表示するページを作成しています。テーブルは PHP 経由で入力されています。フィールドの 1 つで、訪問者は最大 3,000 文字の物語を入力できます。これは長くなる可能性があるため、高さを設定し、スクロール バーを追加したいと考えました。ただし、高さを設定することはできません。

PHP

<?php get_header(); the_post(); ?>

<h1>Prayer Requests</h1>

<?php

$mysqli = new mysqli('localhost', 'root', '', 'aln');
$query = $mysqli->prepare("SELECT `title`, `firstName`, `lastName`, `email`, `address`,     `city`, `state`, `zip`, `country`, `prayer`, `timestamp` FROM `prayerrequests` WHERE 1");
$query->execute();


$query->bind_result($title, $first, $last, $email, $address, $city, $state, $zip,     $country, $prayer, $timestamp)
?>
<table>
<tr><td class="header">Title</td><td class="header">First Name</td><td class="header">Last Name</td><td class="header">E-mail Address</td><td class="header">Address</td><td class="header">City</td><td class="header">State</td><td class="header">Zip Code</td><td class="header">Country</td><td class="header">Prayer</td><td class="header">Date Submitted</td></tr>
<?php
while($query->fetch()) {
echo "<tr><td>$title</td><td>$first</td><td>$last</td><td>$email</td><td>$address</td><td>$city</td><td>$state</td><td>$zip</td><td>$country</td><td>$prayer</td><td>$timestamp</td></tr>";
}
?>
</table>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

CSS

table {
margin: 0 auto;
border: 1px solid #000;
background: #32458b;
background: rgb(54, 79, 139);
background: rgba(54, 79, 139, 0.5);
border-spacing: 0;
border-collapse: collapse;
height: auto;
width: 1000px;
margin-bottom: 20px;
}

tr, td {
border: 1px solid #000;
color: #f1f1f2;
height: 200px;
overflow: scroll;
}

.header{
background: #32458b;
background: rgb(54, 79, 139);
background: rgba(54, 79, 139, 0.8);
}
4

1 に答える 1