I want to remove all enters from an input and replace them with a single space. By that I mean something as </br>. So if someone places the input like this

Hello, my name is bob.
How are you?

It will look like this,

Hello, my name is bob. How are you?

How can this be done in php?

Member Avatar for LastMitch

I want to remove all enters from an input and replace them with a single space. By that I mean something as </br>. So if someone places the input like this

@garyjohnson

I got no idea what you have just mention? Is this related to PHP or CSS?

Can you explain a little more what you just mention?

Is this a text editor issue?

The question you ask doesn't really make any sense because I feel you didn't explain it clearly

Do you have some script you are working with that you can post ?

PHP is a server sided scripting language, so thereforth you cannot change an enter key to turn out as a space unless when the form is submitted all <br/> are changed to " ". I don't know if that is possible because in the code an enter might not be a <br/> but I believe that you would use preg_replace. So when your working with php just note that all php is executed before the page is loaded and not afterwards or during. That being said you will need to use Javascript or some other client side language that works after the page is loaded. Not really sure whether you want it to create a space as the user is typing or after once it's submitted.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.