Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting rid of \r\n
    primarykey
    data
    text
    <p>I'm printing out text from a database and I keep getting <strong>\r\n</strong> and I'm not completely sure why. This is how my code looks like </p> <pre><code>form action="portal.php" method="post" class="label-top"&gt; &lt;div&gt; &lt;label for="name"&gt;News Message&lt;/span&gt;&lt;/label&gt; &lt;form method="post" action="" name="bio"&gt; &lt;textarea name="bio" cols="25" rows="5"&gt; &lt;?php echo stripslashes($_SESSION['bio']) ?&gt; &lt;/textarea&gt;&lt;br&gt; </code></pre> <p>I'm trying to use stripslashes but it's not working</p> <p>I would like my text to be printed out like this </p> <pre><code>Test Test </code></pre> <p>But instead it goes like this</p> <pre><code>Test\r\nTest </code></pre> <p><strong>EDIT</strong></p> <p>After following you guys everything seemed to go fine until I publish it. I think there's something wrong with my POST method</p> <p>If anyone has the time to go over this that'd be greatly appreciated.</p> <pre><code> &lt;?php include("mysql_connect.php"); session_start(); if( $_SESSION['login'] != 1 ) { header( 'Location:login.php' ) ;} if($_SERVER['REQUEST_METHOD'] == 'POST') { $bio = mysql_real_escape_string($_POST['bio']); $user_input = mysql_query("UPDATE members SET bio ='$bio' WHERE username='$_SESSION[username]' "); $_SESSION['bio'] = $bio; } if($_SERVER['REQUEST_METHOD'] == 'POST2') { $bio = mysql_real_escape_string($_POST['notification']); $user_input = mysql_query("UPDATE members SET notification ='$notification' WHERE username='$_SESSION[username]' "); $_SESSION['notification'] = $notifiation; } ?&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="UTF-8" /&gt; &lt;meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"&gt; &lt;title&gt;APPSTARME&lt;/title&gt; &lt;link href="css/style.css" rel="stylesheet" type="text/css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;header&gt; &lt;div class="logo"&gt; &lt;a href="login.php"&gt; &lt;img src="images/logo.png" alt="APPSTARME" /&gt; &lt;/a&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/header&gt; &lt;div class="content"&gt; &lt;article&gt; &lt;h2 class="underline"&gt;Logged in as &lt;?php echo ucfirst($_SESSION['username']); ?&gt; &lt;/span&gt;&lt;/h2&gt; &lt;form action="portal.php" method="post" class="label-top"&gt; &lt;div&gt; &lt;label for="name"&gt;News Message&lt;/span&gt;&lt;/label&gt; &lt;form method="post" action="" name="bio"&gt; &lt;textarea name="bio" cols="25" rows="5"&gt; &lt;?php echo nl2br($_SESSION['bio']); ?&gt; &lt;/textarea&gt;&lt;br&gt; &lt;input type="submit" value="Update Message" /&gt;&lt;/form&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload