如何有一个垂直标题和textarea

时间:2013-07-18 13:07:19

标签: html

我有一个代码...服务器端,似乎无法加载,其中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';
?>

显示此代码的内容如下所示

错误

分辨率

联系/ S

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

我想要发生的是

错误 - TEXTAREA

决议 - TEXTAREA

联系/ s - 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>";

但我得到的是

错误

分辨率

联系/ S

TEXTAREA

TEXTAREA

TEXTAREA

1 个答案:

答案 0 :(得分: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;