Jump to content

Recommended Posts

i have a text area on my page, but when i do a new line using return, it is not displaying a new line on the output to screen. how can i successfully use returns so it is displayed in paragraphs for example.

im using the following:

[b]$message = $_POST['messagebox'];[/b]

[b]<textarea name="messagebox" cols="40" rows="5" style="width:300px"></textarea>[/b]

thanks again, mofish
Link to comment
https://forums.phpfreaks.com/topic/11189-text-area-new-lines/
Share on other sites

Hi,

I have this same problem and am using the nl2br function.

But if someone sends a message with one or more single quotes in it i get the following:

typed in textarea: foo isn't bar

displayed in HTML: foo isn\\\'t bar

For some reason 3 backslashes are added before the quote every time and this happends to every quote in the message.

e.g.

He's it's she's = He\\\'s it\\\'s she\\\'s

How can i stop this properly?

Thanks.
Link to comment
https://forums.phpfreaks.com/topic/11189-text-area-new-lines/#findComment-41858
Share on other sites

[!--quoteo(post=380032:date=Jun 4 2006, 05:27 PM:name=SetLar8)--][div class=\'quotetop\']QUOTE(SetLar8 @ Jun 4 2006, 05:27 PM) [snapback]380032[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hi,

I have this same problem and am using the nl2br function.

But if someone sends a message with one or more single quotes in it i get the following:

typed in textarea: foo isn't bar

displayed in HTML: foo isn\\\'t bar

For some reason 3 backslashes are added before the quote every time and this happends to every quote in the message.

e.g.

He's it's she's = He\\\'s it\\\'s she\\\'s

How can i stop this properly?

Thanks.
[/quote]

Try using $message = nl2br(htmlentities($message));


htmlentities($message) should get ride of the \\\ problem.
Link to comment
https://forums.phpfreaks.com/topic/11189-text-area-new-lines/#findComment-41861
Share on other sites

[!--quoteo(post=380045:date=Jun 4 2006, 10:20 PM:name=SetLar8)--][div class=\'quotetop\']QUOTE(SetLar8 @ Jun 4 2006, 10:20 PM) [snapback]380045[/snapback][/div][div class=\'quotemain\'][!--quotec--]
no, that didnt help.

Any other ideas?

Thanks for your help anyway
[/quote]

[code]
<?
$message = nl2br(htmlentities($message));
$goawaybackslash=str_replace("\\\","",$message);
echo $goawaybackslash;
?>

[/code]
Link to comment
https://forums.phpfreaks.com/topic/11189-text-area-new-lines/#findComment-41880
Share on other sites

Hi,

Following the above i have found the following:

When i submit the message first time there is only 1 backslash "\'"

But when i pass the variable to another page 2 more are added.

You can check this out here: [a href=\"http://www.maxiehost.com/uk/support.htm\" target=\"_blank\"]http://www.maxiehost.com/uk/support.htm[/a]

When entering the message click send, on the next screen you can see the message with only one backslash for each single quote. when you enter the verification code and submit there are then 2 more added to each single quote.
Link to comment
https://forums.phpfreaks.com/topic/11189-text-area-new-lines/#findComment-41910
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.