Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.