Jump to content

Keeping NewLines.


GB_001

Recommended Posts

Hello,

I am trying to output a string from a text box that keeps it'soriginal  sign that it was entered in but everytime I post it to the backend,

It ignores the newlines (like when a person presses enter for a new line) and prints out only the spaces.

 

Thankyou,

-GB.

 

<?php
session_start();
include('Connect.php');

$email=$_GET['email'];
$pword= md5($_GET['password']); 
$error="0";

mysql_query("UPDATE Ysers SET Online=1 WHERE email='$email'");
mysql_query("UPDATE Ysers SET Talking='' WHERE email='$email'");
mysql_query("UPDATE Messages SET MSG='' WHERE User1='$email'");
mysql_query("UPDATE Messages SET MSG='' WHERE User2='$email'");

$query="SELECT * FROM Ysers WHERE email='$email' AND password = '$pword' ";
$result=mysql_query($query)or die(mysql_error());

if(mysql_num_rows($result)==0){

$error="<table align=left><tr><td> <font color=white>Sorry, but either the username or password you entered is not valid.<br><br><br><br><br><br><br><br><br>HELLLOOOOOOO</font></td></tr></table>";

}else{

$_SESSION['email']="$email";
$_SESSION['password']="$pword";
$_SESSION['C']=1;
include "memberspage.php";

}

if(!empty($error)){
echo"$error <br>  $pword";
include('Register2.html');


}


?>

Link to comment
https://forums.phpfreaks.com/topic/120773-keeping-newlines/
Share on other sites

Crap I did the wrong showcode.

Here it is:

<?php
session_start();

include('Connect.php');

$User=$_SESSION['email'];
$Friend=$_GET['F'];
$Comment=$_GET['C'];
$getN=mysql_query("SELECT * FROM Ysers WHERE email='$User'");
$row2 = mysql_fetch_array($getN);
$Name=$row2['Name'];
$PIC=$row2['Picture'];
$PIC="Images/$PIC"; 
list($width, $height, $type, $atrib) = getimagesize($PIC);
if($width>150||$height>200)
{
    $P=$width/150;
    $PH=$height/150;
    
    $MW=$width/$P;
    $MH=$height/$PH;
}

$pww=(360-$MW)-15;
$newstring = nl2br($Comment);
$Time=date('Y-m-d');
$CF="<table height=40px width=360px style='color:white; background: black; border: 1px solid white;'>
     <tr>
     <td COLSPAN=2 style='border-bottom: 1px solid white;'>$Name -$Time</td>
     </tr>
     <tr>
     <td><img src=$PIC height=$MH width=$MW/></td><td valign=top style='padding: 15px;'>$newstring</td>
     </tr>
     </table><br/><b id='ZZZZZZZZZZ'>";
     
$Cmenty=mysql_query("SELECT * FROM Ysers WHERE email='$Friend'");
$row = mysql_fetch_array($Cmenty);
$CD=$row['Comments'];
mysql_query("UPDATE Ysers SET Comments='$CF $CD' WHERE email='$Friend'");
echo"$CF";
?>

 

Sorry about that.

Link to comment
https://forums.phpfreaks.com/topic/120773-keeping-newlines/#findComment-622545
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.