new lines in texarea

B

Baxter337

I am trying to pass a php variable that i get from a mysql text field
to a javascript function, but that text field has newlines in it.


<a href="#top"
onclick="closeit('my_docs');closeit('uploadLink');showit('docUpdate');setup_update_form('<?=$docrow[0]?>',
'<?=$docrow[2]?>', '<?=str_replace("\n", "", $docrow[3])?>')"><img
src="images/update.gif" width="90" height="60" border="0"></a></td>

when it turns to html i get somethign like this for setup_update_form
call:

setup_update_form('81', '(ttest)bottle.bmp', 'test line 1
test line 2
test line 3
test line 4')"><img src="images/update.gif" width="90" height="60"
border="0"></a></td>

this obviously doesnt work.

as you can see i have tried multiple string parsing function with no
success.

I dont know if this matters or not but the form that is getting
submitted to the mysql database has enctype="multipart/form-data"

Any help would be greatly apreciated. Thanks!
 
V

VK

I am trying to pass a php variable that i get from a mysql text field
to a javascript function, but that text field has newlines in it.

Make sure that PHP processor converts all new lines in text data into
"\n" string and insert it only after that. One more time: not \n escape
sequence but back slash - n charachter sequence: "\n"

Not a JavaScript problem really.
 
N

Nate12o6

How egsactly is that done?

Make sure that PHP processor converts all new lines in text data into
"\n" string and insert it only after that. One more time: not \n escape
sequence but back slash - n charachter sequence: "\n"

Not a JavaScript problem really.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,797
Messages
2,569,647
Members
45,374
Latest member
VernitaBer

Latest Threads

Top