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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:48:04+00:00 2026-06-03T13:48:04+00:00

Hello I am saving email address from a textarea in a database. Now i

  • 0

Hello I am saving email address from a textarea in a database. Now i want this data to be put in an array so I can send each email addres a mail.

On every line break there is an e-mail adres like so:

<textarea>
my@email.com 
my2@email.com 
my3@email.com
</textarea>

This data is save in the database as LONGTEXT. I get this data out of the database as a String.
But I want the data to be put in an array. So each email gets an unique index.
Note that no special characters like ‘\n’ and < br > are save in the database.

Thanks in advance!

  • 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-03T13:48:05+00:00Added an answer on June 3, 2026 at 1:48 pm

    Your question seems to indicate that you’re saving the email addresses in the textarea as whole rather than first splitting them up and saving each address separately. You will want to take the latter approach. Why split/validate everytime you read out of the database?

    First, split the incoming emails with:

    $email_addresses = preg_split('/\r\n|\n|\r/', $_POST['email_addresses']);
    

    The regex allows you to take into account the different end of line characters the different platforms out there use.

    Then you can loop over the addresses and validate each with:

    filter_var($email_address, FILTER_VALIDATE_EMAIL)
    

    Then save each address in its own row in the database.

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

Sidebar

Related Questions

Hello I am saving number of lyrics paragraph for song Entity. now I want
Hello I have been having trouble with this for a while now. I have
chaning xml attributes through jquery is easy-peasy, just: $(this).attr('name', 'hello'); but how can I
Hello I have an edit item form. From this view, look at item.current_item_status_date .
I want to set a variable from a flash file so that I can
Hello everyone I am trying to resize an image of 700kb with imagecreatefromjpeg. This
Hello! I'm not even sure if this is possible, but hopefully it is in
Hello! I would like to extract all citations from a text. Additionally, the name
Hello one question I have which I can’t find the solution to is I
Hello i have the this problem, i need your help to figure out what

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.