When writing a form submit to a file, strip line breaks and commas

Posted by bccarlso on Stack Overflow See other posts from Stack Overflow or by bccarlso
Published on 2010-04-01T18:09:36Z Indexed on 2010/04/01 18:13 UTC
Read the original article Hit count: 252

Filed under:
|
|

I have a form with a textarea in it. I log the results to a text file on the server, but I would like to strip out any line breaks a user would put in the textarea, as well as any commas that would interfere with importing the comma-delimited log text file into Excel or something for later use.

I think this has to do with regex, but I'm no expert and could use some help. Or maybe there is an easy PHP function that will do it?

© Stack Overflow or respective owner

Related posts about regex

Related posts about php