I'm trying to take the data entered into a form element and write it into a text file. First I want to strip out any whitespace and especially carriage returns and newlines.
I think Trim() should handle this very easily, but I don't seem to be getting the required results in my text file. Here's my code:
So if I write say,PHP Code:
// $form_var passed from form input
$form_var = trim($form_var);
$fp = fopen("edit.txt", "w");
in the form, I get exactly the same output in the text file, whereas I want it to say - This Sucks
Why is this? Thanks.