WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-07-2004, 03:24 PM
amorphic8's Avatar
amorphic8 amorphic8 is offline
WebProWorld Member
 

Join Date: Oct 2003
Location: San Jose
Posts: 69
amorphic8 RepRank 0
Default annoying PHP mySQL textbox problem

I have created a form that allows site owners to add, edit and delete events from their calendar pages.

It all works fine except for the textbox.

When the original form is filled out, the text that comes from the text box is converted using nl2br (new line to
) before storing in the database. I have taken this step to preserve the formatting typed in by the user. When the calendar or events page is called, the information has line breaks in the right places and the desired effect is acheived.

for example if the original is:

event information line1
event information line2
event information line3

in the database it looks like:

event information line1

event information line2

event information line3



The problem is when the event is edited. The editEvent.php script pulls the text from the database and pops it into a textbox for editing. The
's show up in the textbox. Is there an anti-function for nl2br?
__________________
amorphic8
http://www.amorphicmedia.com
Reply With Quote
  #2 (permalink)  
Old 07-07-2004, 03:47 PM
jdiben jdiben is offline
WebProWorld Pro
 

Join Date: Jul 2003
Location: New Jersey, U.S.
Posts: 293
jdiben RepRank 0
Default

you could try
Code:
$data= str_replace("
", "\n", $data);
before printing the $data variable to the textbox.

Joe
Reply With Quote
  #3 (permalink)  
Old 07-07-2004, 04:06 PM
amorphic8's Avatar
amorphic8 amorphic8 is offline
WebProWorld Member
 

Join Date: Oct 2003
Location: San Jose
Posts: 69
amorphic8 RepRank 0
Default

Actually, that didn't work completely.
It took out the
's but printed the lines with extra blank lines between them.

I tried

$info=str_replace("
", "", $info);

and that worked fine.

Thanks...

don't know why I didn't think of str_replace myself.

Much Appreciated!
__________________
amorphic8
http://www.amorphicmedia.com
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: annoying, mysql, php, problem, textbox



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Search Engine Friendly URLs by vBSEO 3.0.0