Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7162787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:47:34+00:00 2026-05-28T13:47:34+00:00

In a textarea of an html form I allow multi line inputs such as:

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:47:34+00:00Added an answer on May 28, 2026 at 1:47 pm

    After our discussion in chat, here’s what we figured out:

    You used

    shell_exec("cat ".$PATH."/LatexTemplate.tex | sed -e 's/LatexCode/$latexcode/' > ".$PATH."/TexFiles/Q$id.tex");
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I create a html form like this: $form = new Zend_Form(); $form->setMethod('post'); $form2->addElement('textarea',
I am posting a form with a textarea in it. I allow HTML to
I have an html form where the width of a textarea is specified with
Let's say I have an html form. Each input/select/textarea will have a corresponding <label>
I have an HTML textarea: <textarea> Some text Another text in another line BOOM
I have a textarea within an HTML page into which my users paste content.
i have a textarea and two buttons like <form name=form1> <textarea name=text1> HTML Codes
I have a user form with a textarea that allows users to submit html
I'm trying to get the contents of a textarea in an HTML form using
Using the HTML Form Elements, I would like to allow an input of numeric

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.