In a textarea of an html form I allow multi line inputs such as:
hello
goodbye
This string is then put into a mysql database with mysql_real_escape_string.
Now I want to take this string and pass it directly into a tex document, but the empty lines (carriage returns I suppose) are not being output with the string. Hence when this is compiled with latex I get the output
hellornrngoodbye
What do I need to do to my string to retain the carriage returns?
After our discussion in chat, here’s what we figured out:
You used
inside a PHP script to insert the latex input stored in the DB into a template file and save that. Somewhere in this process, the newlines got dropped.
The best solution would be to replace the shell exec with a PHP equivalent that loads the file into a string, performs a string replacement with the (unescaped) input string and stores it in another file.