I have to pass a string to a form. I want to use a mix of $_GET and $_POST in the following way:
Advice: You probably should think about putting this into a hidden field
Answer: But if you are going to put it into action as a GET parameter, then you need to urlencode the string:
<form action="this_page.php?string=<?php echo urlencode($string); ?>" method="post" name="name">
That way - any non-alphanumeric characters will be url safe (think about what might happen if $string contained a ? or a # or an = ).
PHP automatically decodes GET parameters when loading them into the $_GET array - so your newline should be preserved at that point.