Jump to content

[SOLVED] adding line breaks


contra10

Recommended Posts

i have a form set-up where the user inputs writting and its saved in the db, thing is when i take the lines out of the db the query shows all the words in one line with my word string,

 

ie. if a user enters this in the form:

------------------

Dear, John

 

I would like to say hello.

 

Sincerely,

Bob

----------------------

 

it comes out as this in the viewing

----------------------

"Dear, John I would like to say hello. Sincerely, Bob"

----------------------

 

heres my code to enter

 

<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 400 characters. )<br> 
<textarea name="message" wrap="physical" cols="28" rows="4" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 11px; background-color: #72A4D2;" onKeyDown="textCounter(this.form.message,this.form.remLen,400);" // change 125 to anything you wish
onKeyUp="textCounter(this.form.message,this.form.remLen,400);"></textarea>

 

don't think thats too necessary

 

but heres the important code when i echo the results

<?php
$text = ($evdescription);
$newtext = wordwrap($text, 80, "<br />\n",true); 

echo "<table border='0' align='right' width='500'>";
echo"<tr><td>";
echo "<b>COST:</b> $$cost ";
if ($username == $creator ){
echo " <a href='http://localhost/events/deleteevent.php?ev=$eidnum'><b>Delete Event </a>| ";
echo " <a href='http://localhost/events/updateev.php?ev=$eidnum'> Edit </b></a>";
}
echo"</td></tr>";
echo "<tr><td height='25' width='80%' valign='top' align='center' bgcolor='#0183AE'><FONT FACE='ariel' size'12'><h1><b>$evname</b></fOnt></td></tr>";
echo "<tr><td height='175' valign='top' align='center'>$newtext</td></tr>";
echo "<tr><td align='left'><b>Date:</b> $as $evday, $evyear </tr>";
echo "<tr><td aligh='left'><b>Email:</b><i> $evmail</i></td></tr>";
echo "<tr><td align='left'><b>Address:</b>$evaddress</td></tr>";
echo"<tr><td align='left'><b>Time:</b> <font size='2' color='red'>$evhour:$evminute $evtimea - $evhourb:$evminuteb $evtimeb</font></td></tr>";
echo "</table>";
?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/153091-solved-adding-line-breaks/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.