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!

Link to comment
Share on other sites

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?

 

 

Link to comment
Share on other sites

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

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.