corillo181 Posted January 16, 2007 Share Posted January 16, 2007 how do i make text come out the wayt hat the user send type it in the typing box.. cuz when they type comething in to the box like thishi!i got a question.how can i make this work?thank you.it come out like thishi! i got a question. how can i make this work? thank you.when i echo the text out from the query. Quote Link to comment Share on other sites More sharing options...
trq Posted January 16, 2007 Share Posted January 16, 2007 Use [url=http://php.net/nl2br]nl2br[/url] when outputting the string. Quote Link to comment Share on other sites More sharing options...
utexas_pjm Posted January 16, 2007 Share Posted January 16, 2007 You can put it in <pre> tags or run it through the nl2br() function. http://www.php.net/nl2brBest,Patrick Quote Link to comment Share on other sites More sharing options...
corillo181 Posted January 16, 2007 Author Share Posted January 16, 2007 tried it this was the result i wrote:yok lo ktoy pati.result.yornklokrntoy pati Quote Link to comment Share on other sites More sharing options...
trq Posted January 16, 2007 Share Posted January 16, 2007 Post your code. Quote Link to comment Share on other sites More sharing options...
corillo181 Posted January 16, 2007 Author Share Posted January 16, 2007 insert[code]<?include_once'../includes/header.php';include_once'../includes/db.php';if(isset($_POST['Submit'])){$mess=$_POST['message'];$sub=$_POST['sub'];$rusername=$_POST['username'];$mess=htmlspecialchars($mess);$sub=htmlspecialchars($sub);$mess=mysql_real_escape_string($mess);$sub=mysql_real_escape_string($sub);$mess=stripslashes($mess);$sub=stripslashes($sub);$mess=nlbrdate("F j, Y, g:i a"); $mem=mysql_query("SELECT user_id FROM tra_users WHERE username='$rusername'")or die(mysql_error());$ruser_id=mysql_fetch_array($mem);$today = date("F j, Y, g:i a"); $sql = mysql_query("INSERT INTO tra_users_pms (to_id,from_id,to_username,from_username,time_sent,subject,message,opened,time_opened) VALUES ('".$ruser_id['user_id']."', '$user_id', '$rusername','$username','$today','$sub','$mess', 'no','')") or die(mysql_error());if($sql){echo "done";}}?>[/code]output[code]<tr> <td><?$querypms=mysql_query("SELECT * FROM tra_users_pms WHERE to_username='$username' AND pms_id='".$_GET['viewm']."' ORDER BY pms_id DESC")or die(mysql_error());if($querypms){$update=mysql_query("UPDATE tra_users_pms SET opened='yes' WHERE pms_id=".$_GET['viewm'])or die (mysql_error());}$echopm=mysql_fetch_array($querypms);?> <table width="100%" border="0" cellpadding="0" cellspacing="0" id="tfs"> <tr bgcolor="#606060"> <td>From: <a href="member.php?un=<?=$echopm['from_username']?>"><?=$echopm['from_username']?></a> | Reply | Subject:<?=$echopm['subject']?></td> </tr> <tr class="infotxt"> <td><?=$echopm['message']?></td> </tr>[/code] Quote Link to comment Share on other sites More sharing options...
trq Posted January 16, 2007 Share Posted January 16, 2007 Where in that mess have you used nl2br()? Quote Link to comment Share on other sites More sharing options...
corillo181 Posted January 16, 2007 Author Share Posted January 16, 2007 i was using it in the<?=nl2br($echopm['message'])?> Quote Link to comment Share on other sites More sharing options...
trq Posted January 16, 2007 Share Posted January 16, 2007 What is this line?[code=php:0]$mess=nlbr[/code] Quote Link to comment Share on other sites More sharing options...
corillo181 Posted January 16, 2007 Author Share Posted January 16, 2007 it wa ssupposed to be [code]$mess=nl2br($mess);[/code]but it didn't wokr so i was deleting it before i posted the code.. Quote Link to comment Share on other sites More sharing options...
corillo181 Posted January 16, 2007 Author Share Posted January 16, 2007 now answers to do? Quote Link to comment Share on other sites More sharing options...
Nameless12 Posted January 16, 2007 Share Posted January 16, 2007 if you want to handle the spaces as well as the breaklines $text = str_replace(array(' ', ' ', nl2br($text)); Quote Link to comment Share on other sites More sharing options...
corillo181 Posted January 16, 2007 Author Share Posted January 16, 2007 in wich code should i use that int he output or input? Quote Link to comment Share on other sites More sharing options...
corillo181 Posted January 16, 2007 Author Share Posted January 16, 2007 i tried that a few ways and didn't work.. any one else knows another way? Quote Link to comment Share on other sites More sharing options...
corillo181 Posted January 16, 2007 Author Share Posted January 16, 2007 to everyone trying to help it found a easy waay i just had to use this[code]$text=str_replace('rn','<br>',$text);[/code]the htmlspaiclchars turn the br into rn when going in to mysql just need to replace it again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.