0

我有一个代码...服务器端似乎无法加载,其中 HEADER 是垂直的,我尝试了下面的代码,

<?php
require 'include/DB_Open.php';

$ea_name = $_POST['ea_name'];

$sql="SELECT * FROM ea_error WHERE ea_name = '" . $ea_name . "'";

$myData = mysql_query($sql) or die(mysql_error());

//to count if there are any results
$numrow = mysql_num_rows($myData) ;

if($numrow == 0)
{
    echo "No results found.";
}
else
{
echo '<fieldset><legend><strong>Information</strong></legend>
<table width="auto" border="0" align="center">
<tr><th scope="row">Error</th></tr>
<tr><th scope="row">Resolution</th></tr>
<tr><th scope="row">Contact/s</th></tr>';

while($info = mysql_fetch_array($myData)) 
{
echo "<form action='retrieve.php' method='post'>";
echo  "<td align='center'>" . "<textarea readonly=readonly name=error cols=75 rows=8> " . $info['error'] . "</textarea></td>";
echo  "<td align='center'>" . "<textarea readonly=readonly name=resolution cols=75 rows=8> " . $info['resolution'] . "</textarea></td>"; 
echo  "<td align='center'>" . "<textarea readonly=readonly name=contacts cols=75 rows=8> " . $info['contacts'] . "</textarea></td>"; 
echo "</form>";
echo "</table>";
}
}
echo "</fieldset>"; 

include 'include/DB_Close.php';
?>

这段代码显示的内容如下

错误

解析度

联系方式

然后我会将三个文本区域放在一行中

我想要发生的是

错误 - 文本区域

分辨率 - TEXTAREA

联系方式 - TEXTAREA

请帮助...我也尝试使用 CSS 样式无济于事

table, td, th {
  border: 1px solid red;   
}

thead {
  float: left;   
}

我也尝试使用下面的代码,

echo "<form action='retrieve.php' method='post'>";
echo "<tr>";
echo  "<td align='center'>" . "<textarea readonly=readonly name=error cols=75 rows=8> " . $info['error'] . "</textarea></td>";
echo "</tr>";
echo "<tr>";
echo  "<td align='center'>" . "<textarea readonly=readonly name=resolution cols=75 rows=8> " . $info['resolution'] . "</textarea></td>"; 
echo "</tr>";
echo "<tr>";
echo  "<td align='center'>" . "<textarea readonly=readonly name=contacts cols=75 rows=8> " . $info['contacts'] . "</textarea></td>"; 
echo "</tr>";

但我得到的是

错误

解析度

联系方式

文本区域

文本区域

文本区域

4

1 回答 1

0

如果我正确理解了这个问题,这可能是一个答案(尽管我会完全避免使用表格进行布局设计,而不仅仅是表格数据):

$myRes = "<form action='retrieve.php' method='post'>
        <fieldset>
            <legend><strong>Information</strong></legend>
            <table width='auto' border='0' align='center'>
                <tr>
                    <th scope='row'>Error</th>
                    <td align='center'><textarea readonly=readonly name=error cols=75 rows=8>" . $info['error'] . "</textarea></td>
                </tr>
                <tr>
                   <th scope='row'>Resolution</th>
                   <td align='center'><textarea readonly=readonly name=resolution cols=75 rows=8>" . $info['resolution'] . "</textarea></td>
                </tr>
                <tr>
                    <th scope='row'>Contact/s</th>
                    <td align='center'><textarea readonly=readonly name=contacts cols=75 rows=8>" . $info['contacts'] . "</textarea></td>
                </tr>
            </table>
        </fieldset>
    </form>";

echo $myRes;
于 2013-07-18T13:25:37.413 回答