Jump to content

How to insert a <br> instead of 0d0a on my form submit?


Jaehoon

Recommended Posts

Hey guys,

 

I have a form I'm submitting via POST and I have no idea how to replace the enter spaces in my textarea into a <br>.

 

I've been trying all of these:

$message = ereg_replace("=0D=0A=", "\r", $message);

$message = ereg_replace("=0D=0A=", "<br>", $message);

 

But nothing is working, does anyone know how to accomplish this?

 

Thanks in advance!

Thanks for your help, the code you posted works, but I seem to be capturing the "ENTER" put in by php into the url wrong...

 

URL:

msg=this%0D%0Ais%0D%0Aa%0D%0Atest

 

in the url a ENTER break is represented as %0D%0A , is '=0D=0A=' the proper way to represent the %0D%0A in the replace function?

 

 

No sorry, this is a screenshot of my script...

 

entry.jpg

 

I wanted to represent my blog post as shown on the textarea...

 

Just like the box I'm typing the reply on right now, if i press enter to goto the next line... on the forum it will show up as a break

 

So I guess the main issue is that when I submit my form... my breaks are stripped out, and everything becomes 1 long sentence. I wanted my break to remain so the blog post can be represented with breaks the way it was written into the textarea box

 

I know this problem can be avoided if i type <br> into my textarea to goto the next line, but I wanted to be able to press enter to insert a break automatically

Thanks.. I just found the article @ http://www.plus2net.com/php_tutorial/line-breaks.php

 

I've only been using php for a week, so yeah lol.

 

I am using a mySQL database to store all my data, but I post the form and caught the message with $_GET...

 

Is there a better way to go about this?

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.