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 7843895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:42:23+00:00 2026-06-02T16:42:23+00:00

My goal is to extract each line from a textarea and save it to

  • 0

My goal is to extract each line from a textarea and save it to my mysql db.

I think my problem lies within the AJAX function or the part, where I get the lines from the textarea, but see yourself:

//#userip = textarea;


    var content = $("#user_ip").val();
    var ips = content.split("\n");

    $.ajax({
        type:       'POST',
        url:        'inc.php?ban_user',
        data:       'user_ip='+ips,
        dataType:   'html',
        success:    function(data) {
            alert(data);
        },
            error: function() {
                alert("Error");
        }
    });

And the PHP part is:

        if (isset($_POST["user_ip"])) {

        $user_ip   = htmlspecialchars(trim($_POST["user_ip"]));

            mysql_query("INSERT into banned (ip) values ('$user_ip')") or die(mysql_error());

        echo($user_ip);

    }

At this point $user_ip seems to be just one string of all textarealines combined.

I know that this way the php code above wont work and it will save all lines as one result!

What I want: Save each txtarea-line seperatly in my db.

  • 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-06-02T16:42:24+00:00Added an answer on June 2, 2026 at 4:42 pm

    “data” attribute want an object with “attribute”:value pairs, and your give him a string.

    $.ajax({
            type:       'POST',
            url:        'inc.php?ban_user',
            data:       {'user_ip': ips},
            dataType:   'html',
            success:    function(data) {
                alert(data);
            },
                error: function() {
                    alert("Error");
            }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to extract kernel symbols from a u-boot image The final goal is
I am trying to extract the contour lines from colour topographic maps. The goal
Goal: Extract text from a particular element (e.g. li), while ignoring the various mixed
My goal is to extract certain nodes from multiple XML files with multiple namespaces
Goal: Produce an Excel document with information from 3 associated models that is similar
Goal: Gain datatype date with year and month Problem: Need to help to convert
I want to extract unique characters from files ( UTF-8 , contains asian characters)
I want to extract all the properties from my pom.xml into a properties-file. These
I have a peculiar problem here. I want to extract some generic types, which
Goal, is to extract the content for the CKEDITOR Text Editor, and then only

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.