0

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>";
3
  • Post the exact error u gotten Commented Sep 21, 2013 at 4:48
  • There is no error, I mean that the data is not displayed fully in a table row Commented Sep 21, 2013 at 4:51
  • 1
    can you post your class=zebra CSS so that we can know whats happening.. Commented Sep 21, 2013 at 6:08

4 Answers 4

1

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>';
Sign up to request clarification or add additional context in comments.

4 Comments

Can you please edit the code that I have shown..? While I try to add Hi and P tags it shows an error..
There you go @fishspy
to display it in a table, this code has to be inside a TR and it still can't display all the data ; echo '<h1>From: ' . $row['username'] . '</h1>'; echo '<p>' . $row['usermessage'] . '</p>';
echo "<table class='zebra'> <thead> <tr> <th> Original Message by " . $row['username'] . " posted at " . $row['cqatime'] . " IST</th> </tr> </thead>"; echo "<tbody>"; echo "<tr>"; echo "<td>"; echo '<p>' . $row['usermessage'] . '</p>'; echo "</td>"; echo "</tr>"; echo "</tbody>"; echo "</table>";
1

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

3 Comments

I don't see any overflow: hidden in css file .. donno why TD is not displaying
Are you using any JavaScript/jQuery plugin to handle the table with class="zebra". If so, it must be controlling the display.
I tried this, still no change - echo "<td style=\"overflow: visible\">" . $row['usermessage'] . "</td>";
0
<?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>"; ?>

1 Comment

how are you fetching the records?
0

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; 

2 Comments

I don't see any overflow: hidden in css file;
@fishspy 1st check if the $row['usermessage'] contains the full data that you want to display . try printing it separately and put die just after that print to check whats being printed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.