fishspy
fishspy

Reputation: 123

PHP - Displaying data in a Table Row

I am developing a forum, I have a text area where users input their comment, and I am displaying it in a table row. But I do find that the data is not fully displayed , I mean while creating a post if I enter 500 characters, the table row displays only limited characters restricted to the width of the row. Is there any way to display the data entirely in row?

 Here is the code that displays the message;refer to line - echo "<td>" .    
//$row['usermessage'] . "</td>";


echo "<table class='zebra'>
<thead>
<tr>`enter code here`
<th> Original Message by " . $row['username'] . " posted at " .     
$row['cqatime'] . " IST</th>
</tr>
</thead>";              
echo "<tbody>";
echo "<tr>";
echo "<td>" . $row['usermessage'] . "</td>";
echo "</tr>";       
echo "</tbody>";
echo "</table>";

Upvotes: 0

Views: 407

Answers (4)

anupam
anupam

Reputation: 756

TD should show the full message unless the width of the TD is controlled by CSS, e.g. overflow:hidden?

EDIT:

Try:

echo "<td style=\"overflow: visible\">" . $row['usermessage'] . "</td>";

Upvotes: 1

shivgre
shivgre

Reputation: 1173

You are using a class='zebra' in your table. That class is controlling the behavior of your table data display.

Change the CSS in that class and remove overflow: hidden; 

Upvotes: 0

chirag ode
chirag ode

Reputation: 960

<?php
echo "<table class='zebra'>
<tr>`enter code here`
<th> Original Message by ".$row['username']." posted at ".$row['cqatime']." IST</th>
</tr>
<tr>
<td>".$row['usermessage']."</td>
</tr>
</table>"; ?>

Upvotes: 0

Iznogood
Iznogood

Reputation: 12843

Use h1-4 and p. Ex:

<h1>From: <?php echo $row['username'] ?></h1>
<p><?php echo $row['usermessage']?></p>

P is for paragraphs of text. Perfect if its a message like that. No need for a table. Tables are to display tabular data. Like a products list or something like that.

Also, and this is personal, I never output html like you did. I prefer the way I posted.

edit: since you are getting errors I'll do it your way.

echo '<h1>From: ' .  $row['username'] . '</h1>';
echo '<p>' . $row['usermessage'] . '</p>';

Upvotes: 1

Related Questions