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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stripslashes problem / part of form data vanishing

Status
Not open for further replies.

wraygun

Programmer
Dec 9, 2001
272
US
I have a simple multiline textarea posting to another php page which saves to a text file. It all works fine, but when I use the stripslashes function, everything after the first carriage return is cut off.

I guess my question is. How can I obtain the stripslashes functionality and still maintain everything that's typed in the textarea.

Best regards,
Harold

***You can't change your past, but you can change your future***
 
stripslashes will not truncate so there is something else going on with your script.

we can't debug further without your form code and the processing script.

why are you using stripslashes on form data? if this is because you have magic_quotes turned on, i'd really recommend turning it off.
 
Try pasting the same text all in one line just to verify that the length of a line does not matter.

Then you could use preg_replace() to replace all instances of any carriage return etc...
next use nl2br()
Beware if you allow to edit and repost again many times as a direct result you will multiply the <br /> so you need to output the results via a function that will remove the first instances of nl2br() then repost with nl2br()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top