Jump to content

[SOLVED] Getting Proper spacing in a text field using preg_replace


ifis

Recommended Posts

I am trying to set up a simple blog.  I have a textarea where people can input their thoughts, but when I process the input through the programming it all of the spacing, most importantly the paragraph spacing is removed.  I want to be able to find areas in the text where there are multiple spaces and then replace those with a </p><p>.

$correctarticle=preg_replace('  ++',</p><p>,$_POST['Article']);

this is not working.  Any ideas?  Thanks

I'm still trying to figure out how to implement it.  I tried 2 different ways and it is not working.  Here is what I tried.

$Article=(remove_headers($_POST['Article']));
$Article= nl2br($Article);
echo "$article";

and

article=$_POST['Article'];
echo nl2br("$article");

any ideas?

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.