|
-
Aug 8th, 2002, 05:11 PM
#1
Thread Starter
Hyperactive Member
I get That php.net <pre>
Have you ever wanted to remove the '<br />' tags between
'<pre>' and '</pre>' tags after a call to nl2br()? I just
figured out how to do this and thought others would benefit.
$html = preg_replace(
"/(<pre>)([\w\W]*)(<\/pre>)/e",
"'\\1'.str_replace('<br />','','\\2').'\\3'",
$html);
___________
I want to do same with <textarea> .. I try this code
$html = preg_replace(
"/(<textarea>)([\w\W]*)(<\/textarea>)/e",
"'\\1'.str_replace('<br />','','\\2').'\\3'",
$html);
__________
but it does not work ... Why ?
-
Aug 8th, 2002, 05:17 PM
#2
Lively Member
that is because you are a nim rod.....
if you want to remove the <br> tags then just do htmlspecialchars()
or something like that.
textarea is a lot different then a <pre> tag. why are you even doing php because you apparently don't get it.
Just Imagine what you can do with the power of php.
257 Tutorials and counting.
529 Snippets and growing.
Add yours today @
SnippetLibrary.com
-
Aug 8th, 2002, 05:44 PM
#3
Thread Starter
Hyperactive Member
Teaxarea
please .. I want to remove <br> that beetwen <textarea> and </textarea>
I try above code .. but for sorry does not work .. so can you tell me the right code,please?
-
Aug 8th, 2002, 06:00 PM
#4
Fanatic Member
Cant you just
$text = str_replace("<br>","",$_REQUEST[textarea]);
-
Aug 8th, 2002, 07:01 PM
#5
PowerPoster
Originally posted by scoutt
why are you even doing php because you apparently don't get it.
scathing!
-
Aug 8th, 2002, 08:29 PM
#6
Frenzied Member
for one when you submit text from a text area there is no <br> tags in it unless you insert them your self through code.
if you are doing this then just don't do it.
come on
-
Aug 9th, 2002, 01:31 AM
#7
Thread Starter
Hyperactive Member
-
I insert <br> by code because I want to use this code also with text :
$html=str_replace("\r\n", " <BR> ",$html);
-
Aug 9th, 2002, 06:50 AM
#8
Fanatic Member
Sorry I have no clue what your doing now, you want it to add <br> then remove it again? what?
-
Aug 9th, 2002, 07:25 AM
#9
Thread Starter
Hyperactive Member
B
because I have text contain from many line ! for example :
____________________
do
not
forget
to write this code
[textarea]
The
Code
Is
Here
[textarea]
___________________
so I want replace new line with "<BR>" except new line that between [textarea] and [/textarea]
-
Aug 9th, 2002, 07:37 AM
#10
Lively Member
Just Imagine what you can do with the power of php.
257 Tutorials and counting.
529 Snippets and growing.
Add yours today @
SnippetLibrary.com
-
Aug 9th, 2002, 08:31 AM
#11
Thread Starter
Hyperactive Member
M.R scoutt
That will not help me.
please try to tell me what is the wrong in this code:
$html = preg_replace(
"/(<textarea> )([\w\W]*)(<\/textarea> )/e",
"'\\1'.str_replace('<br />','','\\2').'\\3'",
$html);
Why it work with <pre> but does not work with <textarea> ?
-
Aug 9th, 2002, 09:09 AM
#12
Lively Member
listen and listen carefully.
<pre> tag is not a form tag <textarea> is a form tag. you cannot get the stuff between <textarea>stuff</textarea> because there is nothing there. it is contained in a variable that is produced by name.
<textarea name="something"></textarea>
if you don't want no <br> in the textarea then don't putting any in.
now you say you are using [textarea][/textarea] so which is it.
if you are using [textarea] then YES that link will help you. if you are using str_replace() to take out all the \r\n then DON'T DO IT.
why is this so hard.................
Just Imagine what you can do with the power of php.
257 Tutorials and counting.
529 Snippets and growing.
Add yours today @
SnippetLibrary.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|