Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textarea and newlines

Status
Not open for further replies.

noizee666

Programmer
Aug 14, 2002
10
0
0
DE
Hi,

I have a HTML-Form with a textarea, a selectfield, and some input elements with type="text" in it. If there's a new text in textarea a new instance of an object is created containing the data of all fields and a new option is added to selectfield. on changing the entries of the selectfield data saved in the object is written back to the textarea and text input. If there are linebreaks in textarea they were shown correctly.
Now I need to send the objects to a PHP script.
I use a second form with hidden field for that. first data from object is written in the hidden fields. If I have for example 2 objects, two hidden field named text1 and text2 are created and obejct1.text is written to text1, object2.text to text2. Then the second form is sent to the PHP script, which uses a database to store the texts. If the values are just plain text everything works fine. But I have some problems with linebreaks and special characters.
How do I convert them to save in DB with PHP?
If the Site is opened again the PHP script also creates new instances of the JavaScript object with stored data.
I get several errors. Because of escape characters and linebreaks.

Thanks
Noizee
 
i save line breaks by replacing VbCrLf (in asp) with &quot;<br/>&quot;

you might try replacing &quot;\n&quot; and &quot;\r&quot; with &quot;<br/>&quot;



=========================================================
try { succeed(); } catch(E) { tryAgain(); }
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top