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

  • Home
  • SEARCH
  • 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 7160693
In Process

The Archive Base Latest Questions

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

I have a textarea in a html form where I put: line1 line2 line3

  • 0

I have a textarea in a html form where I put:

line1
line2
line3

Then I press button and send the text via jquery ajax to a php script that handles the ajax request and needs to enter each line to db table as a separate row.

Currently, I send the string as

encodeURIComponent($('#multiline_text').val()) in data: variable in jquery

then I’m trying to break the text into array using explode('\n', $multiline_text) in the php file and then enter each row to db table using foreach.

But I’m getting only one array element and that element is being entered as one row only into the db table and the row has value: “line1 line2 line3” without quotes, instead of having 3 separate rows in the table with values:

line1
line2
line3

What should I do?

  • 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:26:26+00:00Added an answer on May 28, 2026 at 1:26 pm

    Have you tried;

    explode("\n", $multiline_text);
    

    it will need double quotes to recognize the new line.

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

Sidebar

Related Questions

Let's say I have an html form. Each input/select/textarea will have a corresponding <label>
I have an html form where the width of a textarea is specified with
I have an HTML textarea: <textarea> Some text Another text in another line BOOM
I have a textarea as an input in my HTML form. When any user
i have html form with textarea in which i paste some XML, for example:
I have made a feedback form.i put some jquery code to make it animate
I have an HTML form which contains a drop down, a tinyMCE textarea, and
i have an html form full of text fields, checkbox's , and radio fields.
I have a html page form like: @Model.strPayload On the button that submits i
I have a html form with <textarea name=message></textarea> and I get the value by

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.