Jump to content

Text Area spacing...?


Warptweet

Recommended Posts

I have a form, and it's a text area. If I press enter twice, it makes a double space, but when I press submit, and it changes the page, it does not double space!. How can I make my code translate those "enter button" presses into a new line?

 

Just in case you need to know, it's writing whats inside the text box into a row in my MySQL Database. So in a way, you could say that when you press the "enter" button, the text area does not take it as a new line. Here is my code to do so...

 

if ($_GET['cmd'] == 'useredit'){
if ($_GET['edit'] == 'profile'){

$users_names = $_SESSION['s_username'];

$con = mysql_connect("localhost","warp_gm","Forest77");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("warp_gm", $con);

$result = mysql_query("SELECT * FROM gm_users
WHERE username='$users_names'");

while($row = mysql_fetch_array($result))
  {
echo "<form method=\"POST\" action=\"?cmd=useredit&edit=textedit\">
<p align=\"center\">
  <textarea rows=\"8\" name=\"profile_text\" cols=\"46\">" . $row['profile_text'] . "</textarea><input type=\"submit\" value=\"Submit\" name=\"B1\"></p>
</form>";
}
}
}

 

It works, no error is returned, it's simply that it doesnt make a new line.

Thanks for any help!

Link to comment
Share on other sites

umm I had that problem too before

I tried to use nl2br before recording it in the database but it didn't work

so than I used nl2br right before echoing it

so

$text = "adsasdaskmask
adsads
asda
sd";
echo nl2br($text);

well you can try that it did work for me

Link to comment
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.