When exporting data to CSV line breaks can cause problems getting the data into the correct columns, removing them is the best course of action.
This array will remove n and r and commas.
$name = str_replace(array("\r\n", "\n\r", "\n", "\r", ","), ' ', $name);