0

i have a code...server side and cant seem to make it load wherein HEADER would be vertical, i have tried the code below,

<?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';
?>

whats showing with this code is like below

Error

Resolution

Contact/s

then i would have the three text areas here on a single row

what i want to happen is

Error - TEXTAREA

Resolution - TEXTAREA

Contact/s - TEXTAREA

pls help...i also tried using a css style to no avail

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

thead {
  float: left;   
}

ive also tried to use the code below,

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>";

but what i am getting is

Error

Resolution

Contact/s

TEXTAREA

TEXTAREA

TEXTAREA

user2579439
  • 1,193
  • 3
  • 13
  • 13
  • How are you expecting to have those 3 cells in 3 rows, if you're putting then in a single row? Forgot some TRs there? Or I totally didn't get your question. – emerson.marini Jul 18 '13 at 13:14
  • @MelanciaUK i dont think i missed some TR...but if u can show me...i have few sample codes above which didn't work...what i really want is to have a HEADER column and TEXTAREA column in a single row – user2579439 Jul 18 '13 at 13:18
  • you didn't close your table! – Mohammad Areeb Siddiqui Jul 18 '13 at 13:19
  • @Mohammad Areeb Siddiqui table closed....same issue – user2579439 Jul 18 '13 at 13:26
  • 2
    You are using [an **obsolete** database API](http://stackoverflow.com/q/12859942/19068) and should use a [modern replacement](http://php.net/manual/en/mysqlinfo.api.choosing.php). You are also **vulnerable to [SQL injection attacks](http://bobby-tables.com/)** that a modern API would make it easier to [defend](http://stackoverflow.com/questions/60174/best-way-to-prevent-sql-injection-in-php) yourself from. – Quentin Jul 18 '13 at 13:26

1 Answers1

0

If I understood the question correctly, this could be an answer (although I would TOTALLY avoid using tables for layout design and not just tabular data):

$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;
emerson.marini
  • 9,331
  • 2
  • 29
  • 46