?
Solved

Srting function: how bring a comment with <br> or \n on one line

Posted on 2003-03-11
9
Medium Priority
?
176 Views
Last Modified: 2012-05-04
i got the following :

  $dat = "txt/txt.txt";
  $dat = fopen($dat,"a");
  $fcomment = strip_tags($fcomment);
  $fcomment = eregi_replace("\n","<br>", $fcomment);
  $fcomment = stripslashes($fcomment);
  $info = $ftopic."#".$fname."#".$fmail."#".$fcomment;
  fputs($dat,$info);
  fclose($dat);

the output looks like that:

new topic#reto#reto@mail.com#this
br>is my
br>first comment
****************************************************

so why does the line 4 in the script replace me an br> instead of a <br> and how can i get the requested output all in one line like this:

new topic#reto#reto@mail.com#this<br>is my<br>first comment


many thanks;)


0
Comment
Question by:malachay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 
LVL 15

Expert Comment

by:VGR
ID: 8111064
first you have a nl2br() function in stead of silly-unmaintanable-unreliable eregi() calles like "$fcomment = eregi_replace("\n","<br>", $fcomment); "
(you also have str_replace() )

I ***guess*** that the first < should be escaped. I suggest you use SINGLE QUOTES like this :
$fcomment = eregi_replace('\n','<br>', $fcomment);
0
 

Author Comment

by:malachay
ID: 8111198
many thanks this might help.

but about the other thing. do you have an idea. (to bring the whole thing on one line)

thanks
0
 

Author Comment

by:malachay
ID: 8111257
many thanks this might help.

but about the other thing. do you have an idea. (to bring the whole thing on one line)

thanks
0
7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

 
LVL 6

Accepted Solution

by:
carchitect earned 320 total points
ID: 8111330
replace \r\n with <br>
instead of \n
0
 

Author Comment

by:malachay
ID: 8111384
bingo
many many thanks.
0
 

Author Comment

by:malachay
ID: 8111391
so fast. excellent
0
 
LVL 15

Expert Comment

by:VGR
ID: 8111474
how did you "know" it was on Windows ? :D
0
 
LVL 6

Expert Comment

by:carchitect
ID: 8111925
Hi VGR how are you
Its so nice to see you.. here too
so whats up, and how is your answer session going ...
i hope its good..
0
 

Author Comment

by:malachay
ID: 8112295
;) i love windows (?) :0
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question