Solved

my words aint wraping on page?

Posted on 2008-10-31
4
233 Views
Last Modified: 2012-05-05
ok basicly usually the text will fit within a given textbox when posted such as on here... but mine is not :S

below i have posted my page where its displayed... and after that the textbox where its added,,,, can any 1 see a reason why the text is just going in a streight line and not starting a new line when it runs out of space?

the output is  via ?php

   $message=$getreplies3['post'];

   $message= BBCode($message);
   $id2=$getreplies3['postid'];

   ?>
        <?php echo $message?>
<td height="168" valign='top'><div align="center"><?php echo $getreplies3['author'];?><?php $result = mysql_query("SELECT * FROM useronline WHERE(user='".$getreplies3['author']."')");
while($row = mysql_fetch_array( $result )) {
 
$last_active = time() - $row['timestamp'];
}
 
if($last_active < 300) {
 
   echo '<img src="http://www.runningprofiles.com/images/useron.gif" width="12" height="11" />';
   
}
else
{  echo '<img src="http://www.runningprofiles.com/images/useroff.gif" width="12" height="11" />'; }
?></div>
  <p align="center">
  <?
   $query = "SELECT * FROM users WHERE Username = '".$getreplies3['author']."' LIMIT 1"; 
if ($result = mysql_query($query)){
    if (mysql_num_rows($result)) {
        $array = mysql_fetch_assoc($result);
        $image = $array['image'];
		$postnum = $array['post_count'];
 
echo "<img src=\"http://www.runningprofiles.com/members/images/mini/$image\" border=\"1\"  />";?><br />
<span class="style7"> Posts: <?php echo $postnum;?> </span>
 
 
<p> <?
}
}?> 
</p></td>
<td valign='top'>
  <table width="100%" cellpadding="0" cellspacing="0">
    <tr>
      <td width="3%" rowspan="2"><div align="center"><img src="http://www.runningprofiles.com/images/posted.jpg" alt="foot" width="17" height="33" /></div></td>
      <td width="97%"><a href='index.php?page=message&amp;forum=<? echo $forum; ?>&amp;id=<? echo $gettopic3[postid] ?>'><strong>RE: <? echo $gettopic3[title] ?></strong></a></td>
    </tr>
    <tr>
      <td><span class="style7">Replied
          <? $dbtime=$gettopic3['showtime']; $time = date("F j Y, g:i a", $dbtime); ?>
          <?  $dbtime = $gettopic3['lastrepliedto']; 
         $time = date("F j, Y, g:i a", $dbtime); 
 
 
// Get current timestamp
$intTime = time();
// Calculate difference
$intDiff = $intTime - $dbtime;
 
// Check time
switch($intDiff)
{
      case ($intDiff < 60):
                echo "<strong>Less than a minute ago</strong>";
                break;
        case ($intDiff < 3600):
                echo "<strong>Less than an hour ago</strong>";
                break;
        case ($intDiff < 7200):
                echo "<strong>One hour ago</strong>";
				break;
        case ($intDiff < 10800):
                echo "<strong>Two hours ago</strong>";
				break;
		case ($intDiff < 86400):
                echo "<strong>Today</strong>";
				break;
		case ($intDiff < 172800):
                echo "<strong>Yesterday</strong>";
                break;
        default:
               echo $time;
			   
}
?>
      </span></td>
    </tr>
    <tr>
      <td rowspan="3">&nbsp;</td>
      <td><hr color="#CCCCCC" /></td>
    </tr>
    <tr>
      <td align="left" valign="top"><?php
 
   $message=$getreplies3['post'];
 
   $message= BBCode($message);
   $id2=$getreplies3['postid'];
 
   ?>
        <?php echo $message?></td>
    </tr>
    <tr>
      <td   align="right" valign="top"><?php 
 
            include 'editmessage2.php'; 
//Now increase it:
$CONT_ID++;
         
        ; ?></td>
    </tr>
  </table>
 </td>

Open in new window

0
Comment
Question by:runnerjp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:runnerjp
ID: 22851247
here is the textbox the text is written in
<textarea id="inputforum" class="inputforum" name='yourpost' rows='5' cols='40'><?php if(isset($_POST['quote'])) {
                        $quote= $_POST['quote'];
						   $query = "SELECT * FROM forumtutorial_posts where postid=$quote"; 
if ($result = mysql_query($query)){
    if (mysql_num_rows($result)) {
        $array = mysql_fetch_assoc($result);}
      
?>
[quote] Originally Posted by:<strong><?php echo $array['author'];?></strong>
<br><?
echo $array['post']; }}?> [/quote]</textarea>
					  

Open in new window

0
 
LVL 6

Expert Comment

by:fourice
ID: 22851381
Try adding this method:
function br2nl($string)
{
    return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string);
}
And use it like: echo br2nl($array['post']);
A textarea needs newlines (\n) for a new line.
0
 

Author Comment

by:runnerjp
ID: 22851421
i think the problem is if a litter is held down for so long e.g hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh  like so... how could i stop this?
0
 
LVL 44

Accepted Solution

by:
scrathcyboy earned 500 total points
ID: 22855231
To answer the FIRST question -- you have put a DIV UNDER A table TD cell.  That is a real NO-NO.

Either remove the DIV and let the table do its thing, which is to wrap text normally as you expect, or else if you MUST keep the DIV for some unknown reason, then remove the entire table structure.  You cannot put a DIV under a TD in a table without generating exactly this kind of problem -- it is bad coding practice.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question