I want to read GDPR info from a file, then in PHP echo out a confirm box with the info, and I then set a cookie, using php setcookie. I have trouble getting it to work:
$message = file_get_contents("my_gdpr_text.txt");
echo ('<script>confirm("'.$message.'")</script>');
The confirm box just does not pop up at all (not even a blank box). If I set the message value to "Oscar" or anything, it all works, so the problem must be the answer from file_get_contents. I know it is read correctly, by testing with print_r. Is some text formatting needed? Grateful for answer.